[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Understanding the -depth option of find?



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?

<quote from info find>

The `-depth' option forces `find' to print of the entries in a directory 
before printing the directory itself.  This limits the effects of restrictive 
directory permissions by printing the directory entries in a directory before 
the directory name itself.

</quote from info find>

Thanks!
Randy Kramer


Reply to: