I always confess my love of Linux. All I need is some rsync and ssh and there’s nothing I can’t do.
My wife runs Windows 7 and maintains our finances, so backups are important. I tried all the normal stuff like Robocopy and SyncToy, but both would do strange things when added to Taskscheduler.
I’m sure they work fine and I might have neglected to check the box for “Wake up computer to perform this task” and the other box for “only run tasks if this network connection is active“, but, hey, I’m not a Windows guy and only now noticed those check boxes while typing this post.
So I created some directories
- c:sync
- c:syncscripts
- c:synclogs
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect, this must be setup in WinSCP as a saved session and have password saved
open user@192.168.1.254
# Change remote directory where your folder is.
# My folder is /RAID/pub/User_Files/John
cd /RAID/pub/User_Files
# Force binary mode transfer
option transfer binary
# Download file to the local directory
# get archives/* f:backupsarchives*
# Delete downloaded files
# rm archives/*
#
# The line below would sync from remote to local
# synchronize local f:backupsarchives archives
#
# syncing local to remote while deleting removed files
synchronize remote -delete c:John John
# Exit WinSCP
exit
Then I used this command in Task-scheduler:
c:”Program Files (86)”WinSCPWinSCP.exe /console /script=c:syncscriptssync.txt /log=c:synclogswinscp.txt
Actually it I selected “Run Program” then browsed to c:”Program Files (86)”WinSCPWinSCP.exe, Then in the arguments box I added /console /script=c:syncscriptssync.txt /log=c:synclogswinscp.txt
Also keep in mind to check the boxes for “Wake up computer to perform this task” and the other box for “only run tasks if this network connection is active” (while selecting your active wifi or network link)
As an Amazon Associate I earn from qualifying purchases. Read our Privacy Policy for more info.