Copying a file from SFTP with date time
Hello,
I have a file named datafile-2014-06-30.txt in an SFTP location and I am trying to copy to a different location. (Date is today's date)
I have written the following script, but it fails with an error: Can't get attributes of the file '%file%'
option batch on
option confirm off
runwinscp.bat:
set file=datafile-%date:~7,2%-%date:~10,4%-%date:~4,2%.txt
open sftp://user:pwd@xxx.xxx.xxx.xx:xx
get %file%
Any help on this would be great. Thanks.
I have a file named datafile-2014-06-30.txt in an SFTP location and I am trying to copy to a different location. (Date is today's date)
I have written the following script, but it fails with an error: Can't get attributes of the file '%file%'
option batch on
option confirm off
runwinscp.bat:
set file=datafile-%date:~7,2%-%date:~10,4%-%date:~4,2%.txt
open sftp://user:pwd@xxx.xxx.xxx.xx:xx
get %file%
Any help on this would be great. Thanks.