Subject: | Compensate for bad NLST results from FTP server |
Date: | Wed, 3 Dec 2014 14:57:44 -0600 |
To: | bug-libnet [...] rt.cpan.org |
From: | Chris Lindee <chris.lindee [...] cpanel.net> |
Several FTP servers do not properly return values from the NLST command, which prevents rmdir() from working correctly. For example, I ran across an FTP server where
CWD /
NLST first/second/third/
would return an empty list. However,
CWD first
NLST second/third/
would return all of the files (prefixed with "second/third/“). It’s a bit baffling, actually.
A possible solution is to move to the MLSD command, which lists directory contents in a standardized machine-readable way; see http://tools.ietf.org/html/rfc3659#page-23. If a server does not support MLSD, Net::FTP can always fall back on NLST.