Unix directories

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex

    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.


  • Wiseguy

    #2
    Re: Unix directories

    On the wall of the virtual bathroom stall, "Alex" <Reply_To_Newsg [email protected]> scratches:[color=blue]
    > I've just noticed that directories in Unix have different sizes whereas in
    > Windows they don't.
    > Why is this so?
    >[/color]

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

    Comment

    • Phil...

      #3
      Re: Unix directories

      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" <noone@celeron. local> wrote in message
      news:3f4d844b_3 @127.0.0.1...[color=blue]
      > On the wall of the virtual bathroom stall, "Alex"[/color]
      <Reply_To_Newsg [email protected]> scratches:[color=blue][color=green]
      > > I've just noticed that directories in Unix have different sizes whereas[/color][/color]
      in[color=blue][color=green]
      > > Windows they don't.
      > > Why is this so?
      > >[/color]
      >
      > because in UNIX the directory is itself a special file. It's size is
      > proportional to the number of files in the directory.
      >[/color]


      Comment

      • Shyamal Prasad

        #4
        Re: Unix directories

        "Alex" == Alex <Reply_To_Newsg [email protected]> 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


        Comment

        • Neomorph

          #5
          Re: Unix directories

          On 28 Aug 2003 08:48:54 -0500, Shyamal Prasad <shyamal.prasad @ericsson.com>
          two-finger typed:
          [color=blue]
          > "Alex" == Alex <Reply_To_Newsg [email protected]> 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.[/color]

          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.
          [color=blue]
          >
          >I'm very curious as to why you chose to post this question to a Java
          >group?
          >
          >Cheers!
          >Shyamal
          >[/color]

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

          Cheers.

          Comment

          • Phil...

            #6
            Re: Unix directories

            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" <Reply_To_Newsg [email protected]> wrote in message
            news:bijvgb$hdm [email protected] .warwick.ac.uk. ..[color=blue]
            > I've just noticed that directories in Unix have different sizes whereas in
            > Windows they don't.
            > Why is this so?
            >
            > Thanks.
            > Alex.
            >
            >[/color]


            Comment

            • Alex

              #7
              Re: Unix directories

              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" <shyamal.prasad @ericsson.com> wrote in message
              news:yzshe41yjs p.fsf@ericsson. com...[color=blue]
              > "Alex" == Alex <Reply_To_Newsg [email protected]> 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
              >
              >[/color]


              Comment

              • Neomorph

                #8
                Re: Unix directories

                On Fri, 29 Aug 2003 09:10:43 +0200, "Alex" <Reply_To_Newsg [email protected]>
                two-finger typed:
                [color=blue]
                > 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?
                >[/color]

                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.

                Comment

                Working...