On Wed, 07 Mar 2012 08:39:05 -0500, Randy Kramer wrote: > In looking at ways of backing up files and directories, I've found > (among lots of other things), the suggestion to use cpio, often in a > manner like: > > % find . -print -depth | cpio -ov > tree.cpio > > In looking at that, I wondered what the -depth parameter does--at first > I worried that it might limit the depth of recursion that would occur, > but it does not. > > I found an answer of sorts from info find (quoted below), but I don't > really understand how "printing the directory entries in a directory > before the directory name itself" "limits the effects of restrictive > directory permissions". > > I did some googling of that sentence, but all I've found so far are > links to info find. > > Can someone explain, provide some hints, or provide a link to an > explanation?
(...) Here is a nice and plain explanation (it's for BSD systems but should be the same for Linux): http://onlamp.com/pub/a/bsd/2002/03/14/FreeBSD_Basics.html?page=2 "(...) By default, find lists the files it finds by starting at the point mentioned in the find command, in my case . or my home directory. That is, it lists first the directory, and then the contents of that directory. If it encounters a directory that has read-only permissions, find will still provide a list of the contents of that directory to the cpio command, but the cpio command won't have permission to replicate the files in that subdirectory. It is interesting to note that cpio will still be able to create the directory, but as it does, it will set the permissions to read only, so it won't be able to create any files below that directory. However, if you remember to use -depth, find will instead start its search at the lowest level, meaning it will list the contents of directories before it lists the directories themselves. This means that the files will already have been replicated by cpio before it sets the read-only permissions on the parent directory." THT. Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/jj877j$ujn$1...@dough.gmane.org