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.

So I am getting a list of everything in a directory on a ftp server using

data = []
ftp.dir(data.append)

then when I print this out I get back this list

drwxrwxrwx   2 0        0        16384 Oct  3 12:54 Andrew
drwxrwxrwx   2 0        0        16384 Oct  1 16:06 Other Files
drwxrwxrwx   2 0        0        16384 Oct  3 13:13 Python and FTP
-rwxr-xr-x   1 0        0        657 Oct  2 03:55 READ ME.txt
-rwxr-xr-x   1 0        0        235 Sep 30 05:16 START HERE.html
drwxrwxrwx   2 0        0        16384 Oct  3 13:18 Test Directory
drwxrwxrwx   2 0        0        16384 Oct  3 01:06 Test Website
drwxrwxrwx   7 0        0        16384 Oct  1 16:21 Website
-rwxr-xr-x   1 0        0        235 Sep 30 05:16 index.html

What I am wondering is what all the different things mean...

I figured out that d means directory and - means file, but what about the rest in the string drwxrwxrwx or -rwxr-xr-x, and then what do the other things mean? Like on the first line, I presume the 2 is the amount of files? but what about 0 and 0, then what are the other numbers?

share|improve this question
add comment

migrated from stackoverflow.com Oct 3 '12 at 6:21

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

2 Answers

up vote 3 down vote accepted

In drwxrwxrwx, d means it is a directory, the first rwx (r=read, w=write, x=execute) in rwxrwxrwx is the permission for the owner/user, the second rwx is the permission for the group, and the third rwx is the permission for others.

2 0        0        16384 Oct  3 12:54 Andrew

The 2 here is the number of immediate subdirectories it has plus its parent directory and itself. So in this case it suggests directory Andrew has no subdirectories.

If however, it is for non-directory, 2 will stand for the number of hardlinks linked to it.

The 0 0 here is the UID and GID of the user.

The 16384 is the size. Note that, since directory in Unix is essentially a file too, this number therefore does not represent the total size of all files belongs to this directory, it simply refers to the size of this directory file.

share|improve this answer
add comment

Looks like the output you get from running ls -l on a Linux command line. A good reference can be found here, but basically you're seeing permissions (after the d/-, you have the read/write/execute permissions for the owner/group/others), the number of links, the owner, the group, the size of the file, the date it was last modified and the filename. It looks like you have digits for your owner/group fields, so it is possible that this is listing something else (I'm not a command line expert by any means, so this is very possible :) ). The rest appears to match up.

share|improve this answer
add comment

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.