Ruben,

The ls method will return an array of filenames.
It worked fine for me.
Also, add "or die" to each of the methods you use.
My experience with FTP is that it tends to "die" once in a while, resulting
in incomplete directory lists etc....

Cheers,
Michael.

"Ruben Van De Vijver" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hi,
>
> I would like to upload and download files to a Linux server from my
> Windows machine. So, I set out to write a little script that does just
> that. Uploading, it turns out, is no problem. I use an "opendir"
> statement to open the directory, then readdir to read its contents and
> then each file gets "put". This works and so, I thought, that's what
> I'll do for downloading files too. However, I don't seem to be able to
> open the remote directory. I get the message that the $dir cannot be
> opened ("Ik kan $dir niet openen!"). I added a snippet of code below.
>
> Can anybody tell what is going on here and how I can fix this?
>
> best,
>
> Ruben van de Vijver
>
>
> ...
> #my $dir = $ftp->cwd("/home/ruben/journal/"); #this is wrong!
>
> #the value of $dir is 1.
>
> #alternative:
> $ftp->cwd("/home/ruben/journal/");       #it now indicates, through
> $ftp->pwd(); that I am in "/home/ruben/journal/"
> $dir = "/home/ruben/journal/";
> opendir (IN, $dir) or die "ik kan $dir niet openen!";
> my @files = readdir(IN);
> foreach my $file(@files){
> $ftp->get("$file");
> }
> $ftp->quit
> ....
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to