Why is my FTP output file blank?

Solution 1:

This is probably because FTP.exe take control over the shell. So redirections, that are handled by the cmd.exe have no effect.

What you can do, is use the -s:filename option and redirect the whole ftp output to a file. It will contain more then you want, but you can take care of that later.

Or, maybe, look for other ftp clients that have this functionality ( I am not aware of any).

Solution 2:

Igal Serban's answer is correct. Try this,

ftp -s:ftp.txt > ftp.log 2>&1

where ftp.txt is a script, just a list of commands, for example,

help
pwd
quit

ftp.log will capture the output. Adding the 2>&1 means you capture both standard out (normal output) and standard error (any error messages from ftp.exe).

Solution 3:

You can put the dir listing into a local file by doing:

dir [remote-directory] [local-file]

In your case, the command would be

dir . c:\somefile.txt

It doesn't answer the why-question, but accomplishes what you're trying to do.

Solution 4:

The simplest way is open Computer folder where you see all your drives. Here you need to create a shortcut for ftp server. To do this, on empty space in computer folder right click and click on 'Add a network location' click on it and follow the prompt to create shortcut for your network ftp server. If you have password for it or is anonymous do that. You can give it a name too. It will appear in Network location on Computer folder. Now double click it. To open>see, read or play and edit a folder or its file you need to drag>copy or move it to desktop. You can move it back when you are done. It is little bit cumbersome but is working for me. Hope it helps you guys!