home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / cmdpk164.zip / df.cmd < prev    next >
OS/2 REXX Batch file  |  1997-06-12  |  945b  |  30 lines

  1. /* df.cmd - A DF-like script                                   950321 */
  2. /* (c) martin lafaix 1994, 1995                                       */
  3.  
  4. if RxFuncQuery("SysLoadFuncs") then
  5.    do
  6.    call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  7.    call SysLoadFuncs
  8.    end
  9.  
  10. drives = ''
  11.  
  12. if arg() = 0 | arg(1) = '' then
  13.    drives = SysDriveMap()
  14. else
  15.    do i = 1 to words(arg(1))
  16.       drives = drives word(filespec('d',word(arg(1),i)) filespec('d',directory()),1)
  17.    end /* do */
  18.  
  19. say 'Filesystem         1024-blocks  Used Available Capacity Mounted on'
  20. do i = 1 to words(drives)
  21.    parse value SysDriveInfo(word(drives,i)) with drive free max label
  22.    if drive = '' then iterate
  23.    used = max-free
  24.    if max = 0 then
  25.       capacity = 100
  26.    else
  27.       capacity = used/max*100
  28.    say left(strip(label),17) right(max % 1024,10) right(used % 1024,7) right(free % 1024,8) format(capacity,6,0)'%' right(drive,4)
  29. end
  30.