Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backup to external HDD with terminal commands

Is there any terminal command that allows me to backup all my files to an external HDD. My OSX update failed so I need to backup my files some how, ASAP!

like image 503
dHumphrey Avatar asked Nov 22 '14 23:11

dHumphrey


2 Answers

I would go with rsync as it only copies files changed since the last time you ran it, making it quicker on second and subsequent backups.

Assuming your username is Freddy Frog and your external HDD is called My External Drive, you could do this:

rsync -av "/Users/Freddy Frog" "/Volumes/My External Drive"
like image 101
Mark Setchell Avatar answered Oct 27 '22 20:10

Mark Setchell


cp -R /Path-to-folder /Path-to-external-HDD

This wil copy the folder from (Path-to-folder) to the external HDD

If you want to make this an recurring command, the are a few steps to be made:

  • Open texteditor and write:

http://pastebin.com/fNuCMMr4

  • Save it as Backup.plist
  • Now navigate to /Library/LaunchDaemons and place the file in the folder
  • Restart your machine

Every day at 15:00 the folder of /Path-to-folder will be copied to the external HDD (if the mac is running at that time)

And yes, ofcourse you need to modify the code I gave you for the .plist file

like image 3
Roy Avatar answered Oct 27 '22 20:10

Roy