Topic "File name issue with Script"

Author Message
calpekid
[View user's profile]

Joined: 2016-06-21
Posts: 2
Location: Huddersfield
Hello,

I am using the below script to download a file everyday:

# Connect to SFTP server using a password
open FTP DETAILS
# Download file
get /*.zip c:\temp\backup.zip
# Exit WinSCP

The problem is that every time I run the file it asks me to overwrite or rename the file as the name already exists.

is it possible to add in a command to automatically add in the date so that it downloads without an issue?

Many Thanks
Ryan
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
WinSCP should not ask for overwrite confirmation. Assuming you are using the latest version of WinSCP.

Anyway, to add a date use:
get /*.zip c:\temp\backup-%TIMESTAMP#yyyy-mm-dd%.zip

See https://winscp.net/eng/docs/scripting#timestamp
calpekid
[View user's profile]

Joined: 2016-06-21
Posts: 2
Location: Huddersfield
Hi Martin,

that worked perfectly thank you
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