#Initialisation my %hashval; 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 %hashval = $ftp->ls($downloadpath); #Loop through my result foreach my $_file (%hashval) {    $tmp_in_file = $hashval{$_file}->{"filename"}; #We Skip . and ..    if ($tmp_in_file eq ".." || $tmp_in_file eq ".")    {        next();    }    else   {        $ftp->get($downloadpath."/".$tmp_in_file, $localpath_in."/".$tmp_in_file);        $ftp->do_remove($downloadpath."/".$tmp_in_file);    } }