Subject: Re: du does not find all directories
From: [email-masked] (Jim Balter)

6 Feb 1997 21:51:34 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Gary Browning <[email-masked]>
Original-CC: [email-masked]
Original-Sender: [email-masked]

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
"[email-masked]" with one line of text: "help".