Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Jan 11 '10 at 15:01

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

3 Answers 3

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

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.