Automatic backup remote FTP with timestamp script

Advertisement

Guest_DK
Guest

Automatic backup remote FTP with timestamp script

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:
# 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.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum