#Version: # ncftp-3.0beta21-3.i386.rpm # NcFTPGet 3.0.0 # LibNcFTP 3.0b3 # ncftpget has a serious bug. It doesn't do a "CWD /" or equivalent # before it starts spitting out path components. Redhat defaults to /pub # If I recall correctly, the FTP protocol actually has a specific command # to CD to the top level. # # These two commands are correct but fail: ncftpget -v -d - -z -F -r 10 ftp://ftp.redhat.com/pub/redhat-6.2beta/SRPMS/SRPMS/shadow-utils-19990827-7.src.rpm ncftpget -v -d - -z -F -r 10 ftp://ftp.redhat.com/pub/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm # these two are incorrect but succeed: ncftpget -v -d - -z -F -r 10 ftp://ftp.redhat.com/redhat-6.2beta/SRPMS/SRPMS/shadow-utils-19990827-7.src.rpm ncftpget -v -d - -z -F -r 10 ftp://ftp.redhat.com/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm
This is not a bug. RFC 1738 states that URLs use relative paths from the start directory. Furthermore, the "/" characters in the URL are to be interpreted solely as node delimiters and not as characters in a pathname. Therefore your URL ftp://ftp.redhat.com/pub/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm translates into: Connect and login to ftp.redhat.com. cd "pub" cd "redhat-6.2beta" cd "SRPMS" cd "SRPMS" get "pine-4.21-3.src.rpm" Note that it does NOT translate into: cd "/pub" cd "redhat-6.2beta" cd "SRPMS" cd "SRPMS" get "pine-4.21-3.src.rpm" nor: Connect and login to ftp.redhat.com. cd "/pub/redhat-6.2beta/SRPMS/SRPMS" get "pine-4.21-3.src.rpm" That is why URLs involving a user login, i.e. ftp://joeuser@ftp.example.com/public_html/index.html, work since they work relative from the start directory (and in this case user logins start from the user's home directory). Otherwise, URLs would have to use the absolute path to the home directory, which is undesirable. Therefore, if you need to start from the root directory, you need to have your URL explicitly quote the root directory, such as: ftp://ftp.redhat.com/%2Fpub/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm The "%2F" is the "/" character, so that changes the first node in the URL to be "/pub" rather than "pub". Of course, it's really best to not use this and instead use URLs relative to the start directory. Mike Gleason
Mike is correct here; the situation is identical with other tools like wget.