I got this problem while creating a batch script that downloads from a ftp site. While testing a scenario that a file is not existing on the ftp site, the program returns a zero-byte file with the name of the nonexistent file. Apparently the FTP Get command creates a file length of zero bytes when checking to see if the file may be copied to the local computer. Thus, if the file transfer from the remote computer fails (e.g. file is not existing on remote computer), the empty file is not deleted. I got the details from a Microsoft Support page. Using the mget command and checking if the file is downloaded to the local directory, the program does what it is intended to do. Below is a snippet of the code, feel free to comment.

