Leser: 1
|< 1 2 3 >| | 26 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!D:/Programme/Perl
use strict;
use warnings;
use Net::FTP;
my $ftp = Net::FTP->new("host.de");
die "Konnte keine Verbindung aufbauen $!" unless $ftp;
$ftp->login("name", "passwort");
opendir(DIR, "C:/temp");
my @inhalt = readdir(DIR);
foreach(@inhalt)
{
$ftp->put("$_"); #Zeile 17
}
$ftp->quit;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
D:\Programme\Perl\eg>ftp.pl
Cannot open Local file .: Permission denied
at D:\Programme\Perl\eg\ftp.pl line 17
Cannot open Local file ..: Permission denied
at D:\Programme\Perl\eg\ftp.pl line 17
Cannot open Local file berichte.txt: No such file or directory
at D:\Programme\Perl\eg\ftp.pl line 17
Cannot open Local file formate.txt: No such file or directory
at D:\Programme\Perl\eg\ftp.pl line 17
Cannot open Local file text1.txt: No such file or directory
at D:\Programme\Perl\eg\ftp.pl line 17
Quotereaddir DIRHANDLE
Returns the next directory entry for a directory opened by
"opendir". If used in list context, returns all the rest of the
entries in the directory. If there are no more entries, returns
an undefined value in scalar context or a null list in list
context.
If you're planning to filetest the return values out of a
"readdir", you'd better prepend the directory in question.
Otherwise, because we didn't "chdir" there, it would have been
testing the wrong file.
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
my $ftp = Net::FTP->new("host.de");
my $path = 'c:/temp';
die "Konnte keine Verbindung aufbauen $!" unless $ftp;
$ftp->login("name", "passwort");
opendir(DIR, $path);
my @inhalt = readdir(DIR);
$ftp->put($path . '/' . $_) for @inhalt;
$ftp->quit;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
my $path = 'c:/temp';
my $ftp = Net::FTP->new("host.de") or die "Konnte keine Verbindung aufbauen $!";
$ftp->login("name", "passwort") or die "Login failed: $!";
if(opendir(my $handle, $path)) {
while(my $file = readdir $handle) {
next if $file =~ m#^\.\.?$#;
$ftp->put($path . '/' . $file);
}
closedir $handle;
}
$ftp->quit;
my @inhalt = readdir(DIR);
my @inhalt = grep { /^\./ && -f "$path/$_" }readdir(DIR);
closedir DIR;
my $path = <STDIN>;
my $path = <STDIN>;
|< 1 2 3 >| | 26 Einträge, 3 Seiten |