in reply to get contents of directory
my $fn="files.txt"; open OUT,">$fn" || die $!; print OUT grep(!/^$fn$/,map { $_.="\n"; $_ } <*>); close OUT;
This assumes that the current working directory is the one you wish to index. If it is not:
my $dir="thedir"; my $fn="files.txt"; open OUT,">$dir/$fn" || die $!; print OUT grep(!/^$fn$/,map { s/^$dir\///; $_.="\n"; $_ } <$dir/*>); close OUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: get contents of directory
by dkubb (Deacon) on Jan 20, 2001 at 15:13 UTC |