#! Perl -w
use strict;
use File::Find;
my $fdir='C:';
my @filelist = ();
find(\&wanted, $fdir);
write_file() if (@filelist);
sub write_file() {
.... # sub that writes @filelist to a text file
}
sub wanted {
my $thisfile = $File::Find::name;
push(@filelist, $thisfile) if ($thisfile =~ m/\.txt/); #for ex
+ample
}
hth | [reply] [Watch: Dir/Any] [d/l] |
| [reply] [Watch: Dir/Any] |
`dir /s/b c:\ > x.txt`;
This page is intentionally left justified. | [reply] [Watch: Dir/Any] [d/l] |
Here's a simple script using File::Find:
Just run it from the top directory, use / for the
whole filesystem, and run it as root. To output it to a textfile:
./filelister > my.txt
#!/usr/bin/perl
#filelister
# Recursively searchs down thru directories for files
use warnings;
use strict;
use File::Find;
find (\&found,".");
$" = "\n";
print "@ARGV\n";
exit;
sub found{
push @ARGV, $File::Find::name if -f;
}
| [reply] [Watch: Dir/Any] [d/l] |
Since you are on windows you can do it easily enough with one DOS command from the C: root directory:
dir /s /b > file.txt
Edit: ok,ok... I'm slow. Geez. :-\ | [reply] [Watch: Dir/Any] [d/l] |
If you had a real operating system you could do this ...
find / > allfiles
| [reply] [Watch: Dir/Any] [d/l] |
I don't know the motivation behind your question.
But you may look at
slocate
before reinventing wheels. It allows to store in a efficient
manner such a list of file and to search on that list.
It may even be supported on Windows.
I got the URL from the rpm package but it seems wrong.
Probably the right URL may be found trhu google
--
stefp -- check out TeXmacs
wiki | [reply] [Watch: Dir/Any] |