This is a simplified version of a script to list all the files on a webserver, it works ok but it would be easier if I could print the full path of each file rather than just the file's name.
I have read through the Docs of File::Find and they don't appear to cover what I require.
Is it possible to get the path for each file or am I barking up the wrong tree?
I could write a long winded script to perform this task but you guys seem to manage tasks like this with a couple of lines of code.
Keith
I have read through the Docs of File::Find and they don't appear to cover what I require.
Is it possible to get the path for each file or am I barking up the wrong tree?
I could write a long winded script to perform this task but you guys seem to manage tasks like this with a couple of lines of code.
Code:
use File::Find qw(find);
my $path = abs_path $ARGV[0];
find( \&search_all_folder, $path );
sub search_all_folder {
chomp $_;
return if $_ eq '.' or $_ eq '..';
read_files($_) if (-f);
}
sub read_files {
my($part,@AllData);
my ($filename) = @_;
open (LOG, "<$filename") || print "No $filename";
my @AllData = <LOG>;
close (LOG);
foreach $part (@AllData){
print "<span style='color:#ff0000;'>$filename</span><br>$part<br><br>";
}
}
Keith