Post a reply

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)


Topic review


Automatic backup remote FTP with timestamp script


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:

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
# Exit WinSCP

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.