Forum Moderators: coopster & phranque

Message Too Old, No Replies

Perl Net::FTP Module Help

Downloading a File to a Specific location using NET::FTP

         

Shadi

7:27 pm on Aug 21, 2003 (gmt 0)

10+ Year Member



Hiya,

am currently writting a script that downloads a file. But for some reason am unable to download the file to a location that i set, am not sure of the syntax and haven't been able to work it out from perldoc.



$ftp->get($required_timetable_increment,$required_timetable_increment,"D:/archive");

Above is the bit of code that i am trying to use to get get the file.

$required_timetable_increment, contains the name of the file that i need e.g. RJJT123.ZIP

any help on the matter would be appreciated.

jeremy goodrich

9:49 pm on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What kind of error message are you getting? Do you have the -w switch on in your script and are you "using strict"?

You might take a look at this thread about net::ftp & uploading files [webmasterworld.com]...as far as I can remember, the 2nd post there is a fully working script.

Perhaps you could bastardize some of that code...?

Shadi

1:54 am on Aug 27, 2003 (gmt 0)

10+ Year Member



i basicly have a file on a FTP server and i want to take it from there and put it in a folder called for example

C:\windows\myfolder\

i keep getting access denied.

looking at your script in the other thread do i have to OPEN a directory before i put something in it using the ftp->get() command?

wkitty42

2:46 am on Aug 27, 2003 (gmt 0)

10+ Year Member



shadi,

have you tried "D:/archive/" instead of the one you show with no trailing slash? it could be as simple as that...

Shadi

4:04 am on Aug 27, 2003 (gmt 0)

10+ Year Member



i've worked it out, one of the things is yes as you said above to use / in directory listing rather than \.

but to put a file in a specific folder you have to change to that folder i.e.



chdir($timetabledir); <--
$ftp->binary();
foreach my $file (@dir)
{
$ftp->get($file);
print "Downloaded file $file\n";
}

where $timetabledir = "D:/mydirectory/ZipsNew";

:)