Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dan A

macrumors newbie
Original poster
Dec 2, 2012
2
0
Hi, I was wanting to create like a batch file for Apple Mac for rsync but not sure how you do this.


I just want the file to sit on my desktop and click it every time to make a backup.


These are the commands I wish to use.


rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 1
rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 2

Also I am using the -a rather than -r as it preserves the time modified stamp, whereas -r will switch it to the time it was transferred to my knowledge.

With the -a option if my computer died and I had to reimage would I still be able to access everything off the external HDD that is being used as the backup?


Any assistance would be great, i've been googling but havent really come up with much.

Thanks
Dan
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
All you would need to do to execute those lines is to save them to a file with the addition of a shebang (#!) and the interpreter you wish to use.

Code:
#!/bin/bash

rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 1
rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 2

Copy paste that into a text editor and save it as say, "Backup Photos" to your desktop. Open up the Terminal and enter: chmod ugo+x ~/desktop/backup\ photos and you're done.

The -a flag is a combination of many options including -r, the reason that time is preserved is the -t flag. You can read all about rsync in the manual in terminal just type: man rsync
 

Dan A

macrumors newbie
Original poster
Dec 2, 2012
2
0
Thanks mate, all good now, just one question I still have a query on, If I am using the -a option as it copies all the permissions across, if my HDD fails for some reason and I need to reimage, will I be able to access the files off the backed copy on the external HDD

All you would need to do to execute those lines is to save them to a file with the addition of a shebang (#!) and the interpreter you wish to use.

Code:
#!/bin/bash

rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 1
rsync -a -v /Users/administrator/Pictures /Volumes/Photos\ Disk\ 2

Copy paste that into a text editor and save it as say, "Backup Photos" to your desktop. Open up the Terminal and enter: chmod ugo+x ~/desktop/backup\ photos and you're done.

The -a flag is a combination of many options including -r, the reason that time is preserved is the -t flag. You can read all about rsync in the manual in terminal just type: man rsync
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
Thanks mate, all good now, just one question I still have a query on, If I am using the -a option as it copies all the permissions across, if my HDD fails for some reason and I need to reimage, will I be able to access the files off the backed copy on the external HDD

The permissions will be preserved so it should not be an issue as far as I can tell. The -a (short for archive) is pretty much made for different backup scenarios, there are a lot of stuff written on rsync for backups that may be worth looking into if you are concerned about it's reliability.
 

denzaltrueman

macrumors newbie
Sep 15, 2012
16
0
Thanks for the nice tips. It could be good enough for getting your valuable and memorable pics and data backup using resync.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.