I need to do the following:
1. Move all the files that fall under certain pattern (in this case all csv files that start with GL_.... GL_*.csv) from local machine to a remote SFTP server;
2. Check if the move was successful;
3. If it was, move all the local files to another directory
I got the 1st part working somewhat. I created a batch file and am able to run it from the command line. It moves the files from the local machine to the remote SFT server just fine (I still need to figure out how to automate this process...probably via Windows scheduler).
I'm not sure how to check for the successful script execution and based on that build a logic to move the local files to another directory.
I saw an example here: http://winscp.net/eng/docs/guide_automation#results
but I cannot figure out where all of that stuff belongs to. I need to make it part of the same batch file I'm executing from the command line.
Furthermore, it sounds like I cannot really move local files to another location using batch scripting? I found an example here: http://winscp.net/eng/docs/script_local_move_after_successful_upload
but again, I'm not sure where to add this stuff after executing batch file:
if %ERRORLEVEL% neq 0 goto error
echo Upload succeeded, moving local files
move *.* c:\backup\
echo Upload failed, keeping local files