Helpful Information
 
 
Category: FTP Help
Net::FTP Question

i am trying to get a file but anything with a space in it gives me an error:

$fn = "blah bla";

$ftp->get("$fn","path");

will say 'Bad file name'

i read that the newer Net::FTP module gets around this, however does anyone have any ideas on how to get around this without installing the new module(also, rename is not an option since i don't have write access)?

thanks!:D

The problem is probably because Net::FTP just sends "@_" to the server, try this on $fn:



$fn =~ s/[^a-z0-9]/\\$1/g;


You might find that if you do that, and then a new Net::FTP gets installed, it will then be double-slashed out (which would be bad). You could just check the Net::FTP version before you do that regex there though, to make sure it needs to be done.

[edit] replaced $fh with $fn ;p

Just a guess - but put a %20 and see what happens!

I'm pretty sure if you just get rid of the double quotes for single quotes it will work fine

$fn = 'some file';

-Chris

thanks for the replies...none worked however i figured out a way around it by just using a shell script to ftp when a space was encountered










privacy (GDPR)