Topic "Copying a file from SFTP with date time"

Author Message
Ram

Guest


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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
You seem to be mixing WinSCP and Windows commands.

See this (otherwise unrelated) article to learn how to work with environment variables in WinSCP script:
http://winscp.net/eng/docs/guide_protecting_credentials_for_automation#scripting
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License