Thread FTP Programm Upload (25 answers)
Opened by duerov at 2005-11-22 14:33

Crian
 2005-11-22 14:55
#60306 #60306
User since
2003-08-04
5871 Artikel
ModeratorIn
[Homepage]
user image
perldoc -f readdir

Quote
readdir 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;


Also probier mal

Code: (dl )
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;
\n\n

<!--EDIT|Crian|1132664291-->
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;

use strict; use warnings; Link zu meiner Perlseite

View full thread FTP Programm Upload