in reply to Re: Re: Re: Re: (golf) Recursively delete empty directories from a tree
in thread (golf) Recursively delete empty directories from a tree
/1
/2
/3
/4
/5--
\__
\1
\2
\3
\howdy
Everythings empty except for the empty file 'howdy'. If I run your code from the top with "deldir .":
I get no output at all and the script dosn't remove anything.use File::Find; finddepth sub {(!-d or /^.{1,2}$/)||rmdir($_); warn $File::Find::name,$! if $! =~ /not empty/},@ARGV;
If I run the following:
Everything gets deleted giving this output:use File::Find; finddepth sub {(!-d or /^.{1,2}$/);rmdir($_); warn $File::Find::name,$! if $! =~ /not empty/},@ARGV;
./5/3Directory not empty at ./delete-empty-dirs-recursive1 line 10. ./5Directory not empty at ./delete-empty-dirs-recursive1 line 10.I see what you are saying about the -d test not being performed, but I don't see how your code runs. Maybe you have a magic machine. If you or someone can explain why your code dosn't run on my machine, I would be grateful.
|
|---|