Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: NET::FTP - Can't fetch

by Anonymous Monk
on Feb 27, 2008 at 20:19 UTC ( [id://670732]=note: print w/replies, xml ) Need Help??


in reply to Re: NET::FTP - Can't fetch
in thread NET::FTP - Can't fetch

That worked, great, but the files downloaded should be on the same directory where I am running this script right? Is there a way to send the files to another location in a directory above the one that this script runs from?

Replies are listed 'Best First'.
Re^3: NET::FTP - Can't fetch
by moklevat (Priest) on Feb 27, 2008 at 20:42 UTC
    This question is answered in another recent thread you might have seen. Saving FTP File.
Re^3: NET::FTP - Can't fetch
by jrsimmon (Hermit) on Feb 27, 2008 at 20:44 UTC
    Sure. You just want to add an argument to your get statement with the new directory:
    #!/usr/bin/perl -w use Net::FTP; use CGI qw(-oldstyle_urls :standard); use CGI::Carp qw(fatalsToBrowser); use strict; my $q = new CGI; my $host="myhost"; my $dir = "/home/docs/test/"; my $new_dir = "/home/docs/new_test"; my $login = "xyxyxy"; my $pw = "uyuyuy"; my $ftp = Net::FTP->new($host) or die "Cannot connect to $host: $@"; $ftp->login($login,$pw) or die "Cannot login to $host as $login: $@"; $ftp->cwd($dir) or die "Cannot change working directory: $@"; my @files=$ftp->ls or die "Cannot list current directory: $@"; foreach my $x_files(@files) { $ftp->get($x_files, "$new_dir/$x_files") or die "Can't fetch $x_files: $!\n"; } $ftp->quit;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://670732]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-19 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found