cpdup backup question

Oliver Fromme check+iu9znf00rsf2xvn9 at fromme.com
Mon Feb 6 09:35:51 PST 2006

Terry Tree <terry.tree at xxxxxxxxx> wrote:
 > Hello.  I'm trying to use cpdup to backup my desktop to my little home
 > server via NFS.  The question I have is there a way to have a global
 > cpignore file ?  I don't have to place an ignore file in every
 > directory.  I want to exclude all of my mp3 and iso files so my server
 > doesn't fill up.  Does anyone know of a work around for this ?

My workaround for similar things is not to use cpdup, but
find(1) and cpio(1).  In your case, something like this
should work:

# cd $SOURCE
# find -d . | egrep -v '\.(mp3|iso)$' | cpio -dump $TARGET

Another advantage is the fact that mtimes of directories
will be preserved, which cpdup doesn't do.

However, the disadvantage is that cpio will always copy all
files, even if they already exist in the destination.  But
that can be fixed to some extent by using the -newer option
of find:  Before starting the backup, touch a file.  For
the next backup, use that file as a "marker" to backup only
files that are newer or have changed since then:

# touch /var/db/thisbackup
# cd $SOURCE
# find -d . -newer /var/db/lastbackup | grep -vf /etc/backup.excl | cpio -dump $TARGET
# mv -f /var/db/thisbackup /var/db/lastbackup

# cat /etc/backup.excl

Best regards

Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd

Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

More information about the Users mailing list