473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unix directories

I've just noticed that directories in Unix have different sizes whereas in
Windows they don't.
Why is this so?

Thanks.
Alex.
Jul 17 '05 #1
7 2692
On the wall of the virtual bathroom stall, "Alex" <Re****************@xyz.abc> scratches:
I've just noticed that directories in Unix have different sizes whereas in
Windows they don't.
Why is this so?


because in UNIX the directory is itself a special file. It's size is
proportional to the number of files in the directory.

Jul 17 '05 #2
Not sure if I agree that windoz has fixed size directories. What is your
evidence.
The root directory seems to have a limit of the number of files you can put
in it, but
that seems to not be true of other directories. In unix the number of
directory entries
and files for that matter is limited by the number of inodes that were
created for the filesystem
isn't it?

"Wiseguy" <no***@celeron.local> wrote in message
news:3f********@127.0.0.1...
On the wall of the virtual bathroom stall, "Alex"

<Re****************@xyz.abc> scratches:
I've just noticed that directories in Unix have different sizes whereas in Windows they don't.
Why is this so?


because in UNIX the directory is itself a special file. It's size is
proportional to the number of files in the directory.

Jul 17 '05 #3
"Alex" == Alex <Re****************@xyz.abc> writes:

Alex> I've just noticed that directories in Unix have different
Alex> sizes whereas in Windows they don't. Why is this so?

A Unix directory is just a file that contains an entry for each
element contained in it. The more files or subdirectories (inodes) in
it, the larger the size.

I don't know the Windows file system architecture so I can't tell you
anything new about it.

I'm very curious as to why you chose to post this question to a Java
group?

Cheers!
Shyamal
Jul 17 '05 #4
On 28 Aug 2003 08:48:54 -0500, Shyamal Prasad <sh************@ericsson.com>
two-finger typed:
"Alex" == Alex <Re****************@xyz.abc> writes:

Alex> I've just noticed that directories in Unix have different
Alex> sizes whereas in Windows they don't. Why is this so?

A Unix directory is just a file that contains an entry for each
element contained in it. The more files or subdirectories (inodes) in
it, the larger the size.

I don't know the Windows file system architecture so I can't tell you
anything new about it.
Windows hides the information on the number of sectors that are used to
represent a directory.
The only information you can get about a directory, is the number of files
in it. There is no way to gain more information about the number of blocks
used for the directory entries, unless you access the file system on a
lower level (assembly language or special libraries).

(the following assumes a FAT or FAT32 file system...)
Programs like Norton Speedisk are able to see that low and can recover lost
space from directory nodes where there are a lot of deleted files. It
compresses those directory entry blocks, loosing the ability to undelete
the files that used to be in there in the process (unless you use the
Norton Protected Recycle Bin - which even keeps deletion of files from
recovering the blocks they used - until more room is needed, anyway).

Another, manual way to recover those blocks is by moving the files and
subdirectories to a new directory, deleting the old one, and then renaming
the new directory to the old name. You would only do this if you had
thousands of files in the directory, that were subsequently moved or
deleted.

I'm very curious as to why you chose to post this question to a Java
group?

Cheers!
Shyamal


Especially, since this kind of information is at a level that the standard
java libraries cannot get at.

Cheers.
Jul 17 '05 #5
I was looking this up on the web (liars database) and it SEEMS
that on windows the NTFS file system has directories as B trees
so they can grow, and the FAT file system has directories stored
as normal files so they can grow too (except the root maybe).

Phil...

"Alex" <Re****************@xyz.abc> wrote in message
news:bi**********@wisteria.csv.warwick.ac.uk...
I've just noticed that directories in Unix have different sizes whereas in
Windows they don't.
Why is this so?

Thanks.
Alex.

Jul 17 '05 #6
I discovered the fact while writing an 'Explorer style browser' in java and
the size field wasn't 0 for directories in linux.

I haven't tried this yet but since directories and links are files in Linux
does this mean that I can reproduce them by writing data to a new file? or
do I have to set certain lower level bits to do this?

"Shyamal Prasad" <sh************@ericsson.com> wrote in message
news:yz*************@ericsson.com...
"Alex" == Alex <Re****************@xyz.abc> writes:

Alex> I've just noticed that directories in Unix have different
Alex> sizes whereas in Windows they don't. Why is this so?

A Unix directory is just a file that contains an entry for each
element contained in it. The more files or subdirectories (inodes) in
it, the larger the size.

I don't know the Windows file system architecture so I can't tell you
anything new about it.

I'm very curious as to why you chose to post this question to a Java
group?

Cheers!
Shyamal

Jul 17 '05 #7
On Fri, 29 Aug 2003 09:10:43 +0200, "Alex" <Re****************@xyz.abc>
two-finger typed:
I discovered the fact while writing an 'Explorer style browser' in javaand
the size field wasn't 0 for directories in linux.

I haven't tried this yet but since directories and links are files in Linux
does this mean that I can reproduce them by writing data to a new file? or
do I have to set certain lower level bits to do this?


The latter. Dispite the fact that the content of the blocks on the harddisk
is almost the same for files and directories, it's the chmod bits that make
the difference.
The OS commands and libraries make sure that this does not get confused
(i.e. you can't normally change a directory into a file, or read from the
directory with normal file operations).

Cheers.
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: paul | last post by:
hey there all! i'm writing some little programs, and i'd like to know about how to deal with directories on unix. i've read up on this, but the docs don't really mention much on it. do i use the...
3
by: Justin Johnson | last post by:
I have a unix id that has group1 for a primary group, and group2, group3, and group4 for supplementary groups. I'd like to change my primary group before running certain commands. So sometimes I...
5
by: pekka niiranen | last post by:
Does anybody know Python recipe for changing the date of the directory or files in W2K to current date and time? In UNIX shell command "touch" does it. -pekka-
4
by: Murali | last post by:
I have a project in Unix which uses the make utility. I want to change the environment to VC++. Are there any tools which would help me in creating VC++ workspaces from my make files and the source...
3
by: K.S.Liang | last post by:
Hi all, 1> If there are more than one dynamic linking libraries in the file system, how do I know which one is loaded into system? Any C library or system call can tell me which *.so or *.sl is...
0
by: niket patel | last post by:
Hi There is a unix server and and we access unix and perform its commond using exceed or ftp through dos. Now i want to create an application in Visual Studio C#.Net 2003 such that i can create...
8
by: Jamie | last post by:
Hello Newsgroup: This is my little rant about security and why we have home directories. You may choose to ignore it or disagree with it, that is your perogative and I won't care, but... this...
65
by: Hongyu | last post by:
Dear all: I am trying to write to a file with full directory name and file name specified (./outdir/mytestout.txt where . is the current directory) in C programming language and under Unix, but...
1
RRick
by: RRick | last post by:
I have a unix C++ project that needs to be converted over to windows visual studio. I'm not sure of the exact version of VS, but it's a recent version, probabIy 2003 or 2005. I would like the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.