use Net::FTP; use File::Copy; $Login = "abc"; $Pwd = "pwd"; $ftpHost = "10.23.2"; $ftpFolder = "F1"; $matchPattern = "Jeeves"; $LocalDirectory = \etc\local; $ftp=NET::FTP->new($ftpHost,Timeout=>100); $ftp->login($Login,$Pwd); $ftp->cwd($ftpFolder); # to find files that match the pattern @files = grep /$matchPattern/, $ftp->dir foreach(@files) { print $_; # Successfully prints the filename, but with all the details like permissions date created etc. # I need to write a code that helps me get this file out into a local directory # I need to then delete the file. }