#1
  1. SwollenMember
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    the master control
    Posts
    264
    Rep Power
    14

    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!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    The problem is probably because Net::FTP just sends "@_" to the server, try this on $fn:

    Code:
    $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
    Last edited by JonLed; June 26th, 2002 at 02:05 PM.
    Jon Coulter
    ledjon@ledjon.com
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2002
    Posts
    548
    Rep Power
    0
    Just a guess - but put a %20 and see what happens!
  6. #4
  7. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Location
    U.S. Mass
    Posts
    95
    Rep Power
    0
    I'm pretty sure if you just get rid of the double quotes for single quotes it will work fine

    $fn = 'some file';

    -Chris
  8. #5
  9. SwollenMember
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    the master control
    Posts
    264
    Rep Power
    14
    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

IMN logo majestic logo threadwatch logo seochat tools logo