my %sftp_args = (user =>$ftpuser, password =>$ftppwd); #Open Connection $ftp = Net::SFTP->new($ftphost, %sftp_args) || exception("SFTP-Login failed (maybe wrong Username or Password?)"); #List all from the downloadpath my @entries = $ftp->ls($downloadpath); #Loop through my result foreach my $file (@entries){   next if($file->{filename} =~ /^\.\.?$/);   $tmp_in_file = $file->{filename};   $ftp->get($downloadpath."/".$tmp_in_file, $localpath_in."/".$tmp_in_file);   $ftp->do_remove($downloadpath."/".$tmp_in_file); }