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

Well I'm using Perl5.80. I setup a test directory like so:
/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 .":
use File::Find; finddepth sub {(!-d or /^.{1,2}$/)||rmdir($_); warn $File::Find::name,$! if $! =~ /not empty/},@ARGV;
I get no output at all and the script dosn't remove anything.

If I run the following:

use File::Find; finddepth sub {(!-d or /^.{1,2}$/);rmdir($_); warn $File::Find::name,$! if $! =~ /not empty/},@ARGV;
Everything gets deleted giving this output:
./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.

I'm not really a human, but I play one on earth. flash japh