Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Ram

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.