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: fileutils


Hi Jan,

[...]
>I download GNU fileutils 3.16 and compile it - without
>any problem df is running fine and print correct informations.

Jepp, did the same :)

>It on my system give this output:
>
>Filesystem         1024-blocks  Used Available Capacity Mounted on
>C:\temp               521840  261536   260304     50%   /tmp
[...]

And if you want to get something like:

/var                        : 1818.36 MB of 4133.88 MB available ( 43.99%)
/home                       : 1098.43 MB of 2008.09 MB available ( 54.70%)
/etc                        : 1245.38 MB of 3624.01 MB available ( 34.36%)
/                           : 1245.38 MB of 3624.01 MB available ( 34.36%)
-------------------------------------------------------------------------------
            Total           : 5407.54 MB of 13389.99 MB available ( 40.38%)

use the script, I append to this mail :)

>
>I think that should be useful to add df to next cygnus version.
>
>Bye Jan


------------------------< snip snip snip >-----------------------------
#!/bin/sh -

# dfspace - d(isk) f(ree) space
#
# Calculate available disk space in all mounted filesystems
# with the exception of psuedo file systems such as /proc and /dev/fd.
#
# Alternately, report on filesystems/devices specified on cmd-line.
#   Filesystem may be 1K bytes/block, but, df uses 512 bytes/block.
#

# get free and allocated space.
df -k $* 2>/dev/null | awk '
BEGIN {  AVAIL=0; TOTAL=0 }
{
	if ( $6 != "/proc" && $6 != "/dev/fd" && $1 != "Filesystem" )
	{
#print $1 $2 $3 $4 $5 $6
		AVAIL += $4
		TOTAL += $2
		while (length($6)<28) $6 = $6 " "
		printf("%s: %#7.2f MB of %#7.2f MB available (%#6.2f%%)\n",$6, $4 / 1024, $2 / 1024, $4 * 100 / $2 )

	}
}
END { printf("-------------------------------------------------------------------------------\n")
printf("%s: %#7.2f MB of %#7.2f MB available (%#6.2f%%)\n",
	"            Total           ", AVAIL / 1024, TOTAL / 1024, AVAIL * 100 / TOTAL)

}'

# end of disk space calculation.
------------------------< snip snip snip >-----------------------------

Bye.
Michael.
--
Michael Hirmke           | Telefon +49 (911) 557999
Georg-Strobel-Strasse 81 | FAX     +49 (911) 557664
90489 Nuernberg          | E-Mail  mailto:mh@mike.franken.de
                         | WWW     http://aquarius.franken.de/
-
For help on using this list (especially unsubscribing), 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]