use File::Find; use File::Basename; @backupFiles=(); %chompedList=(); $list="/usr/scripts/blist.txt"; if(-e $list){unlink($list);} system("ssh user\@backupserver ls -c /usr/local/apache/htdocs >$list"); open(LIST, "$list") or die "$!"; @backupFiles = ; foreach $file (@backupFiles){chomp $file; $chompedList{$file} = $file;} find(\&dofile, ); sub dofile { ($name,$path,$suffix) = fileparse($File::Find::name); if (not exists $chompedList{"$name$suffix"}) { system("scp -C \"$File::Find::name\" user\@backupserver:/usr/local/apache/htdocs"); } }#end find close(list); unlink($list);