Hello,
I am trying to get a file listing of a directory on a remote server. Right now I am using File::Find:name, which works great on the local computer, but always produces an error message for each file it lists on the remote server. I don't have the error message in front of me, but it says something like, "\\$RemSrv is unknown, using local host". However, it seems to work on the remote server, but is a) really slow and b) the error messages are annoying. Is there a better way to list the files on a remote server?
Any help is appreciated.
Thanks,
- C
I am trying to get a file listing of a directory on a remote server. Right now I am using File::Find:name, which works great on the local computer, but always produces an error message for each file it lists on the remote server. I don't have the error message in front of me, but it says something like, "\\$RemSrv is unknown, using local host". However, it seems to work on the remote server, but is a) really slow and b) the error messages are annoying. Is there a better way to list the files on a remote server?
Code:
#$RemSrv = remote server FQDN
$workingDir = "c:\\temp";
use File::Find;
foreach (@Dir) {
($dir = $_) =~ s{:}{\$}g;
#print "$dir \n";
chomp ($where = `echo $RemSrv\\$dir`);
#print "$where \n";
find (\&echoecho, "$where");
sub echoecho (){
($filename = $File::Find::name) =~ s{/}{\\}g;
($fileV1 = $filename) =~ s{\\$RemSrv\\}{}g;
($fileV2 = $fileV1) =~ s{\$}{:}g;
system "echo $fileV2 >> $workingdir\\FileList.txt";
}
}
Any help is appreciated.
Thanks,
- C