each row of the csv file - source file/target file/source folder/target folder/sftp server details.
I loop through each row and get the file, this works, but fails when there is no file to get -"can't get attributes for file"
The problem to me is -
for each row I have one session or open command execution - This I didn't like. There are multiple rows in the csv file with same server details. I want to look through each row and see if its a new sftp server, if it is, create a new session and get the file.
To accomplish this, I tried using a flags and check if the previous row host and current is same, if same I wanted to use the same session..
Here is the catch -
after opening the session, it doesn't allow any windows batch commands in between winscp commands
Need your help to find a solution to this generic solution.
FOR /f "tokens=1-12* delims=," %%A IN (D:\GENSRVNT\SFTP_TOOL_WK\sftpconfig_Get.csv) DO (
"C:\Program Files (x86)\WinSCP\WinSCP.com" /log="D:\GENSRVNT\SFTP_TOOL_WK\TestSFTPLog.txt" /command >> "D:\GENSRVNT\SFTP_TOOL_WK\TestSFTPLog1.txt" ^
"open sftp://"%%~F"@"%%~H"/ -hostkey=""%%~I"" -privatekey=""%%~J"" -passphrase=""%%~K"" " ^
"get -append -delete -resumesupport=off %%~A/%%~B %%~D\%%~C" ^
if %ERRORLEVEL% neq 0 (