On Thu, 6 Mar 2003, ruben van de vijver wrote:

> 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!";

This opens $dir in your working machine (winblows), not on the remote 
machine (linux).

Take a look at the ls or dir method in Net::FTP
perldoc Net::FTP

> 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