boofulls
asked on
display file names in dirs
i have this code that displays the name of all directories below a certain directory but id also like it to print the names of all files with the .txt extension that are below the directory ($dir)
$dir = "/data/local/apache/htdocs /uploads";
opendir DIR,$dir or die "can't open $dir $!";
while( $file=readdir DIR ){
print "file is $file<br>";
print "dirfile is $dir/$file<br>";
next unless -T "$dir/$file";
open FILE,"<$dir/$file" or warn "can't open <$dir/$file $!";
local $/=undef;
$text=<FILE>;
}
thanks
$dir = "/data/local/apache/htdocs
opendir DIR,$dir or die "can't open $dir $!";
while( $file=readdir DIR ){
print "file is $file<br>";
print "dirfile is $dir/$file<br>";
next unless -T "$dir/$file";
open FILE,"<$dir/$file" or warn "can't open <$dir/$file $!";
local $/=undef;
$text=<FILE>;
}
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.