How to Batch Upload things via Bat\Powershell to SFTP using WinSCP

Upload.bat

[pastacode lang=”markdown” manual=”%22C%3A%5CProgram%20Files%20(x86)%5CWinSCP%5CWinSCP.com%22%20%2Fscript%3D%22C%3A%5CFTP%5CConnection.txt%22%0Aif%20%25ERRORLEVEL%25%20neq%200%20goto%20error%0A%20%0Aecho%20Upload%20succeeded%2C%20Moving%20Files%20to%20Uploaded%20folder%20or%20they%20will%20reupload%0A%0AREM%20Move%20Files%0Apowershell%20-command%20%22move-item%20%22%22%22%5C%5Cfiles%5Ctest*.csv%22%22%22%20%22%22%22%5C%5Cfiles%5CUploaded%5Ctest*.csv%22%22%22%20-Force%22%0A%0Aexit%20%2Fb%200%0A%20%0A%3Aerror%0Aecho%20Upload%20failed%2C%20keeping%20local%20files%0Aexit%20%2Fb%201″ message=”” highlight=”” provider=”manual”/]

C:\FTP\Connection.txt

[pastacode lang=”markdown” manual=”%0Aopen%20sftp%3A%2F%2Fusername%3Apassword%40sftp.server.com%3A22%2F%0A%23Open%20Local%20Folder%0Alcd%20%22%5C%5Cfiles%5C%22%0A%0A%23Upload%20Test*.csv%0Aput%20Test*.csv%0A%0A%0A%23%20Exit%20WinSCP%0Aexit” message=”” highlight=”” provider=”manual”/]

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...