In a previous post, I explained why PASV mode is the preferred method to connect to an FTP server. That is all well and good, but how do you actually USE PASV mode?
The FTP client that ships with Windows does not support PASV mode. Google will tell you that it does, by using the raw command. However, this is not true, you cannot perform PASV connections using the Windows FTP client. It can only do active connections. So if you are behind a firewall that does not allow this, how do you do command line FTP?
Command line FTP is useful for scheduled operations often performed from a script. On Windows, this might be a batch file executed by the Windows Task Scheduler. Well, if you wish to automate a file transfer in this way, you will almost certainly have to download a third party FTP client that supports PASV data channels.
One FTP client that is available for this task is ncFTP. For uploading or downloading a file inside a script, you can use the ncftpget and ncftpput programs respectively.
For example, to download a file from an FTP server using PASV mode, you can use ncftpget with the following options.
ncftpget -F -u <username> -p <password> <site name>.smartfile.com /path/to/remote C:pathtolocal