So, I just went and upgraded to a newer libnet in the hopes that it would handle filenames with spaces better. (As per Spaces in file names with Net::FTP) Unfortunately, I couldn't find any examples which showed -how- people made the newer Net::FTP work with spaces in filenames. Of course, I'm trying to build the filenames on the fly (with timestamps), instead of just a 'string filename'.
My current code is as follows:

my @type = ('farm\ &\ ranch', 'land', 'residential'); my $server = 'not.the.real.server.net'; my $c = Net::FTP->new($server); $c->login('username', 'password') or die "couldn't log in: $!\n"; for my $i (0..2) { $c->get("listings-$type[$i].txt.gz"); for my $j (0..6) { my $k = timestamp($j); $c->get("pics-$type[$i]-$k.tar"); } } $c->quit(); exit; sub timestamp() { my $days = shift @_; my @today = localtime(time - (86400 * $days)); $today[4]++; $today[5] += 1900; return sprintf("%04d%02d%02d", @today[5,4,3]); }

I'm sure that this could be written more tightly. I'm far more interested in 'working' than 'tight' right now, since this needs to be working before I leave for a week this evening.

I have verified that I am connected to the server, am logged in correctly, and can download the other files that don't have spaces in them. Someone's got to know... please help.


In reply to Net::FTP and filenames with spaces by amelinda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.