Useful copy command for backing up

Don’t like backup programs, but I do like cp. I save all my work to an external HDD but I like to make a copy of this onto my server, prior to burning. As I don’t do things in sequence, I may need to make several “backups” before commiting to disk, so needed an easy way of only copying over changed or new files:

cp -urvp /pathto/externaldrive/* /pathto/backup/directory/

What does it all do?

cp         the copy command

-u         update only new or changed files with a newer date

-r          recursive to all sub directories

-v          verbose, tell me what is happening

-p          preserve file attributes

In my case, the path to the external HDD is /media/HANDY120/* – (the device is a Fujitsu HandyDrive 120GB) . Don’t forget the / and the * at the end to ensure everything on the drive is copied.

The path to the backup location can be anywhere, but you must use the same route each time

Leave a Reply

Your email address will not be published. Required fields are marked *