That's no different than the original s/^(.+ )(.+?)$/$2/ because of the greediness of the first .+ ...
perl -le '$_="-r--r--r-- date user group blah and stuff.txt"; s/^(.+
+)(.+? ?.+?)$/$2/; print '
And the attempt to fix it with .+? ?.+? to check for an optional space is insufficient .. it will failt for filenames with two or more spaces, and also for filenames with no spaces, it will think the previous column (date or whatever) is part of the filename ...
It might be more robust to use Net::FTP's ls() method instead so you don't have to parse out the other items from the long format that dir() provides. As for excluding directories and links, you could just let them through and have the get fail on those, or maybe combine both ls() and dir() to figure out which are links/directories.
| [reply] [d/l] [select] |
The files that I am getting are on a linux box and none of them even have spaces, which is the reason that I did not catch this is the first place.
The way that my code is written is that it will die on a get failure so unless I do a full re-write, that is not an option.
At this point it is not an issue as none of the files should contain more than one space if even a space at all.
If anyone has some suggestions lets here them.
| [reply] |