in reply to Re: Still problems with recursive coding.
in thread Still problems with recursive coding.
Note that I'm not having it print "No files to delete". If you want that feature you'll have to set a flag or something when you delete something, and check for that flag when your script exits. As you're doing it in your code, you'll get a "No files to delete" message for every file that does not match your regexp criteria, which is probably not what you want.use File::Find; use strict; my $start_from = 'c:\mydocu~1'; if (shift(@ARGV) =~ /all/) { find(\&search_all, $start_from); } else { find(\&search_none, $start_from); } sub search_all { unlink if /\.\d+\w+\-\d+\wm$|\.log$/i; } sub search_none { unlink if /\.\d+\w+\-\d+\wm$/i; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Re: Still problems with recursive coding.
by curtisb (Monk) on Nov 14, 2000 at 02:34 UTC | |
by Fastolfe (Vicar) on Nov 14, 2000 at 02:38 UTC | |
by curtisb (Monk) on Nov 14, 2000 at 02:41 UTC |