My requirement is used to create a ftp batch script to transfer files from Unix to Windows through the WinSCP command line. So, I pass file name to the script and file is transferred from Unix to Windows. However, when I want to transfer multiple files, the challenge here is to take all the file names from the user and run the WinSCP command to get all the files. How to loop the input for the different file names and construct the WinSCP command for the same?
Can someone help me with the approach as I am new to batch scripting?
Sample command to transfer a single file
call C:\Progra~2\WinSCP\WinSCP.exe /console /timeout="120" /command "option batch continue" "option confirm off" "open sftp://%userid%:%passw%@%host%" "get %/file/filename.txt%" "exit"
Sample command to transfer a multiple files
call C:\Progra~2\WinSCP\WinSCP.exe /console /timeout="120" /command "option batch continue" "option confirm off" "open sftp://%userid%:%passw%@%host%" "get %/file/filename.txt%" "get %/file/filename2.txt%" "get %/file/filename3.txt%" "exit"