Re: Understanding the -depth option of find?
>> On Thu, 8 Mar 2012 17:06:54 +0000 (UTC), <firstname.lastname@example.org> said:
C> I make the backup for my /home directory with plain "tar". What are the
C> benefits/drawbacks of using "cpio" instead?
Older versions of tar wouldn't read from stdin or any other list of files,
and they also had really short limits on filename length. Some still do.
I like cpio because it accepts output from "find", a list of files, or any
intermediate filter. I prefer pax because in addition, it'll accept cpio,
ustar, or its own internal format. Other advantages include consistent
behavior and command-line options on FreeBSD, Linux, and Solaris.
Doing things like hourly incremental/differential backups is a snap:
root# touch /backup/etc/drive1
[ ...an hour later... ]
root# cd /drive1
root# dest="$(date '+/backup/drive1/%Y/%m%d/%H%M')"
root# mkdir -p $dest
root# find ./userstuff -depth -newer /backup/etc/drive1 -print |
pax -rwd -pe $dest
In this case, the "-depth" option ensures correct timestamps on all
created directories, and "-pe" preserves owner/group/mode/modtime stuff.
Karl Vogel I don't speak for the USAF or my company
Heck, if an omniscient psycho ex offered me discounted, in-stock products I
was going to buy anyway, I might just keep them around. That's everything
Amazon tries to be already, anyway.
--slashdot response to Target data-mining for pregnant customers