[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Backup advice
Hm.. what's wrong with a quick
rsync -cavz $src/ $dest/
?
Or, rsync-diff (as used in ... um.. rsync-backup, I think it's called,
look on Freshmeat...)
Cheers,
Alex.
On Mon, Mar 25, 2002 at 11:12:27AM +0000, Craig Andrews wrote:
> > purpose. For instance, if you use the update option of copy (-u) only newer
> > or new files are copied, thus solving the problem of copying existing
> > files.
> >
> > find is also a good one for this. See `man find`
>
> Further to my own email, try this one:
>
> -- START --
>
> #!/bin/sh
>
> # List of directories to back up
> dirlist="
> /home/me/backupfiles"
>
> # Root to back up to
> backuproot="/tmp/backup"
>
> # Check if backup root exists
> if [ ! -d $backuproot ]
> then
> mkdir -p $backuproot
> fi
>
> # Loop through all directories in source list
> for srcdir in $dirlist
> do
> # Check if source dir exists
> if [ -d $srcdir ]
> then
> # Create all appropriate destination directories
> for destdir in `find $srcdir -type d`
> do
> if [ ! -d $destdir ]
> then
> mkdir -p $backuproot$destdir
> fi
> done
> # Copy all newer than those already there
> # NB you may want to use -x here to stay on one filesystem
> cp -uva $srcdir $backuproot$srcdir
> else
> # Oops! Invalid search directory
> echo "$srcdir does not exists, or is not a directory"
> fi
> done
>
> -- END --
>
> Just put your own source directories in the dirlist declaration at the top,
> and your own destination in the backuproot.
>
> Craig
> ___________________________________________________________________
>
> Sheffield Linux User's Group -
> http://www.sheflug.co.uk/mailfaq.html
>
> GNU the choice of a complete generation.
>
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.