[Omaha.pm] Challenge: Prune a directory tree

Jay Hannah jay at jays.net
Thu Oct 14 17:35:59 CDT 2004


On Oct 14, 2004, at 4:35 PM, Daniel Linder wrote:
>   find . -depth -type d -exec rmdir {} \;

Wow. Unreal. I didn't know -depth until now.

On Oct 14, 2004, at 3:24 PM, Trent Melcher wrote:
> http://www.stonehenge.com/merlyn/UnixReview/col16.html

Ya...

    Perl's File::Find       Command line
    -------------------     ----------------
    find()                  find ./
    finddepth()             find ./ -depth

    (perldoc File::Find)

If what I was doing was a lot more involved than 'rmdir {}' I'd use 
Perl instead of trying to string together some God awful -exec string 
on the command line.

Beauty! Thanks Daniel! Looks like several of us needed to learn the 
-depth trick!

j



More information about the Omaha-pm mailing list