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]

new dfspace


Hi *,

whoever might be interested - here is a new version of dfspace:

------------------------< snip snip snip >-----------------------------
#!/bin/sh -
#ident "@(#)$Header: dfspace,v 1.3 92/09/14 15:42:50 hannibal Exp $ SNI"
# @(#)dfspace        Revision: 1.7     2/26/91 14:09:51
#

#ident  "@(#)adm:dfspace  1.8.1.4"
# 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; SAV = "" } {
  if ( $6 != "/proc" && $6 != "/dev/fd" && $1 != "Filesystem" ) {
    # print $1 $2 $3 $4 $5 $6
    if( length( $2 ) == 0 ) {
      SAV = $1
    } else {
      if( length( SAV ) > 0 ) {
        AVAIL += $3
        TOTAL += $1
        while( length( $5 ) < 28 ) $5 = $5 " "
        printf( "%.28s: %#7.2f MB of %#7.2f MB available (%#6.2f%%)\n",
                 $5, $3 / 1024, $1 / 1024, $3 * 100 / $1 )
        SAV = ""
      } else {
        AVAIL += $4
        TOTAL += $2
        while( length( $6 ) < 28 ) $6 = $6 " "
        printf( "%.28s: %#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]