Topic "Automatic backup remote FTP with timestamp script"

Author Message
Guest_DK

Guest


Hi,

I would like to have created ​​a batch script that automatically backs up my website files using FTP protocol. Website files are located on remote FTP servers. I want that every time the backup script is run, then the files are saved in a folder with a timestamp.

Like this:
C:\Backups\Webpage_1_DDMMYYYY
C:\Backups\Webpage_2_DDMMYYYY

I have so far been created the following:
Code:
# Automatically abort script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open username@serverhost
# Change remote directory
cd /webpage1
# Force binary mode transfer
option transfer binary
# Download file to the local directory C:\Backups
get /webpage1* C:\Backups\webpage1*
get /webpage2* C:\Backups\webpage2*
# Disconnect
close
# Exit WinSCP
exit


How can I add timestamp to the backup folders?

I want to create the script in batch (BAT) instead of PowerShell because the WinSCP NET Assembly and COM Library requires .Net Framework v3.5/4.0 and I do not want to install this on my Windows Server.

Thanks in advance.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
See http://winscp.net/eng/docs/script_download_timestamped_filename#using_winscp_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