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

dcaccount

macrumors 6502
Original poster
Nov 17, 2013
317
14
Hello,

I back up my directories by zipping them and copying them to a usb stick after renaming them with the pattern: year(2 digits)month(2 digits)day(2 digits).zip.

Can please anyone write a script to automate this task assuming that the directories name is "archive", "house and family", "job"?

I would really appreciate, thanks, Daniele
 
Code:
#!/bin/sh

filename=$(date "+%Y-%m-%d.zip")
zip $filename /path/to/archive/ /path/to/house\ and\ family/ /path/to/job/
cp $filename /Volumes/USB/

Once the file is saved you will need to "chmod +x scriptname.sh"
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.