in reply to Re: How to delete empty files
in thread How to delete empty files

HI
your example gave me an error message
Use of uninitialized value in string eq at C:/Perl/site/lib/File/Find/ +Rule.pm line 586. Use of uninitialized value in substitution (s///) at C:/Perl/site/lib/ +File/Find/Rule.pm line 586. Use of uninitialized value in substitution (s///) at C:/Perl/site/lib/ +File/Find/Rule.pm line 586. invalid top directory at C:/Perl/lib/File/Find.pm line 593.

Replies are listed 'Best First'.
Re^3: How to delete empty files
by leocharre (Priest) on Jan 11, 2008 at 11:03 UTC

    It seems that what gave you an error message was "C:/Perl/lib/File/Find.pm line 593", to be more precise 'invalid top directory'.

    What is your directory argument? Are you leaving it at $ENV{HOME} ? Is this environment variable even set on a windows system?

    Add this to the first lines of code, before we instance File::Find::Rule..

    defined $ENV{HOME} or die("ENV HOME is not defined."); print STDERR " # env home is set at $ENV{HOME}\n"; -d $ENV{HOME} or die("ENV HOME is not a directory");
    (You can always bite the bullet and switch to linux. It takes about a year to get comfortable, if you're considering.)

    Furthermore, *DONT RUN THAT SCRIPT*, it's just an example script! :-)

    Substitute $ENV{HOME} with something like 'C:\path\to\where\you\suspect\empty\files\reside'.

    And *read* File::Find::Rule!

    Don't give up so easily- if something does not work, that's when you start 'debugging'. Takes up most of my time, between tests (.t) and errors, and the fact that a third of my code is to check and recheck return values and results.. In the long run it's saved me a lot of sweat and blood.