Differences between dir and ls FTP Commands

ftp

Hello we have made a little program to upload an .zip file to an FTP server, and when I connect to the FTP server with FileZilla to see everything is ok I can't see the uploaded file.

But if connect to the FTP by an ftp command in the windows shell and perform an ls command I can see the file, but if I instead use the dir command, the file is not listed (in fact, no one file is listed)

So that… what are the differences between these two commands (ls / dir)?

It seems that FileZilla is using the dir command.

Note: I don't know the which FTP server are using but whe i connect it responds "220 sasbas FTP server (Version 4.2 ….)

Best Answer

The difference between dir and ls is that the under the hood the Windows FTP client is sending two different FTP commands.

The dir command sends the LIST FTP command:

Returns information of a file or directory if specified, else information of the current working directory is returned.

The ls command sends the NLIST FTP command:

Returns a list of file names in a specified directory.

This doesn't really explain the difference in the listing, but I would suggest looking into your FTP server's documentation to investigate why you would see different results for these two commands.

Related Question