Avatar of abraha
abraha

asked on 

how to check file exists on remote server

I am working on a Perl script that will logon to remote server and check if files exist on the hard driver.
I am new to Perl scripting, but so fare I got the script to check the files on the local Server now I need to find a way to check the files on the all of the servers.
#!/usr/bin/perl   -w 
use strict;
print "Content-type:text/html\n\n";
#list of files we need to check for
my ($Each_Files, @Array_Files,@Server_List );
@Array_Files = qw(
/perl/Download/file1.loaded
/perl/Download/file2.loaded
/perl/Download/file3.loaded);
@Server_List = qw(host1 host2 host3);
foreach $Each_Files ( @Array_Files)         {
if (-e $Each_Files)
      {
     print "Successfull! \n";
             }
       else             {
     print "Not Successfull! \n";
      }
             }

Open in new window

Perl

Avatar of undefined
Last Comment
abraha

8/22/2022 - Mon