How can I script WinSCP to create a directory for the current date and then post files to that folder?
Posted on 2008-10-17
We have a need to post files via WinSCP daily (approx 1,000-1,200 files). How do we have WinSCP create a folder for the current date then put the files to that folder?
Here is what we are working from:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# open user:firstname.lastname@example.org
# Connect using a password
# Change remote directory
# Force binary mode transfer
option transfer binary
# Upload current file to working directory
# Download file to the local server and place in SFTP2WIN directory
get *.xml SFTP2WIN\*.xml
# Exit WinSCP
Very simple and straight forward. Put I need the batch of files put into a separate directory daily based on the date.
Many thanks for you help,