in reply to Best Way to Search and Delete files on a large Windows Filesystem
Adding the email code and etc is left as an exercise for the read... ;-)use strict; use warnings; use File::Find; # Extensions to match my @exts=qw(.nsf .exe); my $search_root='D:\\Bin\\'; # where to start the search # Build a regex my $rexstr=join'|',map {quotemeta $_} @exts; my $rex=qr/(?:$rexstr)$/i; # list of filespecs my @list; # Find em thanks find({ wanted =>sub{push @list,$_ if (/$rex/ && -f)} , no_chdir => 1 } +, $search_root); # And print em out print join "\n",@list;
BTW: Ive found there is a cute little trick with File::Find under windows. If you use MS style paths (ie backslashes) and dont take advantage of perls ability to handle either then File find will return paths like
Which means that you can easily tell where the childrens path starts by looking for slashes and not backslashes. (Dont worry about \/ Perl handles it transparently.) But be aware that using the trick makes your code completely unportable.D:\Bin\/autoruns.exe
HTH
Yves / DeMerphq
--
When to use Prototypes?
Advanced Sorting - GRT - Guttman Rosler Transform
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Best Way to Search and Delete files on a large Windows Filesystem
by perrin (Chancellor) on Mar 08, 2002 at 18:05 UTC | |
by demerphq (Chancellor) on Mar 08, 2002 at 18:11 UTC | |
|
Re: Re: Best Way to Search and Delete files on a large Windows Filesystem
by Anonymous Monk on Mar 08, 2002 at 18:03 UTC |