From: jqb AT netcom DOT com (Jim Balter) Subject: Re: du does not find all directories 6 Feb 1997 21:51:34 -0800 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <32FAAD0A.6255.cygnus.gnu-win32@netcom.com> References: <199702070226 DOT SAA04777 AT robotics DOT eng DOT sun DOT com> 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 Original-CC: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com 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. -- - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".