This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: du does not find all directories


Gary Browning wrote:
> 
> I do not have gnu-win32 in front of me right now but typically the
> 'du' command has a '-k' flag that reports the sizes in Kbytes.  To
> verify that this is working, try:
> 
>    du -sk large_file
>    ls -l large_file

-k is the default unless the POSIXLY_CORRECT envirnment variable is
defined, in which case the default is 512-byte blocks.

> 
> FYI, last time I used this on gnu-win32 (I do not remember which release),
> I still was not convinced it was correct.

That's because it isn't; it reports half the number of blocks it should.
du -b or du -h ("human readable"; I suggest using this unless you
are going to feed the output to another program/script), however, give
the right numbers (modulo ignoring files and directories due to bogus
inode number matches).

Of course, there is also the problem that du and ls actually open and
*read* every single file (via stat) in order to see if it is a symlink.
As James Mansion has suggested, it could avoid this by checking the
length of the file to see if it is the right length for a symlink.
Another possibility is to give symlinks special names, e.g.,
foo.symlink; this would mean that command /c del foo wouldn't work, but
that is reasonable given that no content-oriented non-cygwin program
will work with symlinks.
 
--
<J Q B>
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]