a question for you shell scripters

Steven Elling ellings at kcnet.com
Fri Mar 28 03:31:58 CST 2003


On Thursday 27 March 2003 20:51, Monty J. Harder wrote:
> "Steven Elling" <ellings at kcnet.com> 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.
>
>   Unless you also use the -depth option, which forces the search to
> examine the contents of the directory before the directory itself.

That would work as well.  I think Mike Coleman's second example is the best 
way to do the task.

> $ find . -depth -type d -empty -exec rmdir {} ;




More information about the Kclug mailing list