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

"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\Scripts\DownloadSFTP.txt"
if %ERRORLEVEL% neq 0 goto error

echo Download succeeded, Do nothing

REM Rename Files to put date on the end , 3 Double Quote each variable as Quotes inside command
powershell -command "Get-ChildItem """\\files\Test*.csv""" | ren -NewName { """$($_.BaseName)$(get-date -format """_yyyyMMddhhmmss""")$($_.extension) """}"


exit /b 0

:error
echo Download failed, keeping local files
exit /b 1
Download.bat

open sftp://username:[email protected]:22/

#Open Local Folder
lcd "\\files\download"

#Open Remote Folder
cd outbound

#Download all folders and delete when done to not download same files
get -delete *

# Exit WinSCP
exit
C:\Scripts\DownloadSFTP.txt
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...