Backup script

Ian Rose ian at themagictree.co.uk
Tue Jun 6 15:01:52 UTC 2006


Dotan Cohen wrote:
> I've been looking for a backup solution for my Kubuntu box, and I'm
> not really happy with any software that I see. So I'm trying to find a
> variant of "cp" that would just copy everything in /home/user/ that
> has been changed in the past X days to /home/user/backup including
> hidden files. I would then just burn ~/backup to a CD-R. I can't get a
> handle on the syntax, though. How is this done?
>
> Note, a link to a bash tutorial that covers this would be nice, too.
> I've several bookmarked, but I'm not very successful with them.
> Thanks.
>
> Dotan Cohen
> http://gmail-com.com
> 74
>
cp -auv --backup=numbered /home/username /pathtobackuplocation

will copy everything from your home to the specified location.
a - archive (recurses directories, preserves permissions and gracefully 
handles links)
u - update (only copies changed files)
v - verbose (tells you what it is doing)
--backup=numbered - for changed files, copies the new version and the 
older versions are rotated into numbered backups. (~1~,~2~,~3~ etc)

I use a variant of this to backup everything on all 3 of my machines - 
just a simple "sudo ./backup" and I'm done (I have multiple users, so I 
need the "sudo" to access their homes).

In konqueror "man:/cp" will give you the full manual for cp.

Hope this helps.

-- 
Ian




More information about the kubuntu-users mailing list