a question for you shell scripters

Gerald Combs gerald at ethereal.com
Thu Mar 27 14:17:48 CST 2003


On Wed, 26 Mar 2003, Steven Elling wrote:

> The `-links' and `-empty' options to find will not work in this case because 
> there could be a branch with subdirectories but no files anywhere in the 
> branch.  The branch would have a indeterminate link count greater than 2 
> and would not match the `-empty' option.

Someone else suggested using '-depth', which processes directory contents
before directories.  A quick test verified that

    find <path> -depth -type d -empty -exec rmdir {} ;

does a proper recursive directory prune.




More information about the Kclug mailing list