Utilize this WinSCP backup script to protect your files using an automated process that helps ensure the integrity and safety of your files. In this tutorial, learn how to use WinSCP in collaboration with WebDrive to automate file backups with HostedFTP. To back up your files, you’ll need 3 requirements:
To setup the WinSCP backup script, follow the instructions below:
Setup your account for backing up files:
Go to the Users Tab and click “Add username” located on the right hand menu.
Create a backup user. Fill in the login credentials and save once complete.
Make sure not to give the user a storage or bandwidth quota.
Next, click “Login” beside the user’s username and use your admin password to login.
Go to the Files Tab and create a backup folder in the root directory i.e “/”
Share the new folder with any users you want to give access to the backup folders (optional).
Remember this backup user’s login credentials and folder name.
Setup WebDrive for backing up files:
Connect to your backup useraccount using the login credentials in the previous step.
Take note of the mounted drive i.e Drive A:
Take note of the folder name i.e backup
Setup WinSCP for backing up files:
In the site manager, input your login credentials for your admin account, or as the user who’s files you want to back up.
Click save and change the site name to something you will remember (optional).
Check “Save password”.
Review your remote site. Make sure all files and folders you want to backup are located inside one directory.
To specify a specific directory, take note of the folder path i.e mainfolder/subfolder1
Create a script to back up files part 1:
Locate the Notepad program. Right click the program and select “Run as administrator”.
Insert the following script: winscp.exe /console /script=script.txt
Save the file using the following settings: Save as type: All Files and File name: script.BAT
Create a script to back up files part 2:
Once again, locate the Notepad program. Right click the program and select “Run as administrator”.
Insert the following script but using your own credentials where necessary:
mget -neweronly /MainFolder(b) A:\backup(c)
a: the name of the site connection you created in WinSCP
b: WinSCP folder path of the folder you want to backup
c: WebDrive backup folder path including the mounted drive
Save the file as: script.txt
Create a script for backing up files part 3:
Locate and open the program folder for WinSCP.
Click and drag both files into the WinSCP folder.
Double click script.bat to run the script.
You can use window’s task scheduler to set a time for when you want the script to run.
NOTE: If you change folder names with this setup, all files, folders and sub-folders will be downloaded and uploaded into the new folder name. Personal accounts do not support automation.