I wanted to backup all my files hosted on Dreamhost to my computer, FTP was slow and out of the question. After searching for a while, I came across a neat program called rsync, a Unix program, that I already had (came with cygwin). Rsync allows you to sync two places. You can use it to sync anything from directories on the same computer to your computer to a remote server.
Here are main switches:
-a Archive (Implies:) >>
-l copy symlinks as symlinks
-p preserve file permissions
-t preserve lasted changed times
-g preserve group
-o preserve owner (root only)
–devices: recreates character/block devices
(receiving end must be root)
–specials: transfer special files like named sockets
-progress Shows file progress
-partial Allow partial files
Now that we know the switches, we can go to usage. (Via cygwin in Windows)
rsync -avP “/cygdrive/c/Documents and Settings/” “/cygdrive/x/”
Archive, verbose (show files being copied), show progress and allow partial files.
Copy Documents and Settings folder to drive X:
You can also specify remote servers.
rsync -av firstname.lastname@example.org:/home/username/ /cygdrive/x/website/
Show files and backups all files on the Dreamhost server in the user’s folder to X:\website on the local machine.
rsync -av /cygdrive/x/documents/ email@example.com:backups/
Show files being copied and backs up files in X:\documents to the directory “backups” on the remote server in the home directory.
These are the basics of rsync and show how a user can do simple sync/copy/backup operations with the program. On Windows, to automate jobs, you first need to setup public/private keys so a password is not required. You can then associate .sh files with bash.exe. Finally, use “cmd /c “start c:\script.sh”” to start a script in cygwin you made (containing rsync or bash commands).