Leser: 3
![]() |
![]() |
2 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#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);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);
}
![]() |
![]() |
2 Einträge, 1 Seite |