Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Net::FTP and filenames with spaces

by jlongino (Parson)
on Feb 12, 2002 at 19:42 UTC ( #144964=note: print w/replies, xml ) Need Help??


in reply to Net::FTP and filenames with spaces

You didn't say what version of libnet you're using. My versions:
This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 regist +ered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 628 provided by ActiveState Tool Corp. http://www.ActiveS +tate.com Built 15:41:05 Jul 4 2001 libnet [1.07.03] Collection of Network protocol modules
The following program works for me:
use strict; use Net::FTP; my $host = 'mysite.net'; my $login = 'mylogin'; my $passwd = 'mypasswd'; my $ftp = Net::FTP->new($host); my $RC = $ftp->login($login, $passwd); if (not $RC) { print "\n\nFTP Login to Remote Host: '$host' failed!\n\n"; print "No files updated from Remote host: '$host'!\n\n"; exit; } ### Delete local copy of remote host ftp files my $infile = "test" . ' ' . "file"; ### also the following works too # my $infile = "test file"; if (-e $infile) { unlink $infile; } ### Make new local copy of remote host ftp files $RC = $ftp->get($infile); if (not $RC) { print "\n\nget command for remote file: '$infile' failed!\n"; print "No files updated from Remote host: '$host'.\n\n"; exit; } $ftp->quit; print "Finished!";
I know you said that you just want to get it working, but you should really consider basic error/return code checking as I've done above. Maybe there are additional problems.

--Jim

Replies are listed 'Best First'.
Re: Re: Net::FTP and filenames with spaces
by amelinda (Friar) on Feb 12, 2002 at 19:50 UTC
    Welp, I had just installed libnet 1.0901, perl 5.002 (yes, I know it's out of date... no upgrade on it currently possible). This is on a MacOS X machine, fwiw.

    I also forgot to mention that I had cut out the error checking I had been doing, for the sake of posting a smaller amount of code. I am doing error checking. Thanks for mentioning it tho.

      After seeing your libnet version (1.0901) I rechecked ActiveState and found that the same (newer than mine) version was available. Thanks, I at least like to keep the modules up-to-date too! I probably should check the rest of my modules for updates too.

      --Jim

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2020-11-28 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?