Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ....)

share|improve this question

migrated from Jan 11 '10 at 15:01

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

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.

share|improve this answer
On GNU/Linux, ls displays the same informations as dir, I tried it on Xubuntu 14.04 LTS. From ftp man page: Print a listing of the contents of a directory on the remote machine. The listing includes any system-dependent information that the server chooses to include; for example, most UNIX systems will produce output from the command ‘ls -l’. (See also nlist.) – baptx Jan 25 at 11:38

The dir returns a full directory listing whereas the ls returns a simplified directory listing.

share|improve this answer
But why dir is not listing the file as ls do? – user24404 Jan 11 '10 at 15:24
Because it is two different commands. "dir" requests platform specific information when "ls" requests only filenames. – Laurent Etiemble Jan 12 '10 at 8:02

It may be a permissions oddity, and may be a platform specific issue. Can you tell us what OS and FTP server software is involved (many servers will announce this information as you connect).

If it responds to the command ls -al, could you add that information to your question? And/Or if you can connect the account using SSH what does ls -al return then?

One other thing - does the zip file have a dot as its first character? This is often interpreted as meaning the file should be hidden unless specifically you specify options otherwise.

share|improve this answer
i have added the FTP connection response to the question. The ls -al command do not return anything and the zip file name doesn't start by dot. – user24404 Jan 11 '10 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .