home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / batnmore.z!p / DUS.BTM < prev    next >
Text File  |  1992-11-15  |  2KB  |  76 lines

  1. *REM This batch file is Freeware, free to use and redistribute unmodified *
  2. *REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
  3.  
  4. REM Show disk usage subdirectorycally (sp.)
  5. REM Timestamp 15-Nov-1992
  6.  
  7. break on^setlocal^unalias *^unset *^if "%1"=="-?" goto info
  8.  
  9. if "%@ascii[%1]"=="45" goto optiot^goto over
  10.  
  11. :optiot
  12. set plaza=%@eval[%plaza+1]^set %@ascii[%@substr[%1,%plaza,1]]=1
  13. if %plaza lt %@eval[%@len[%1]-1] goto optiot^shift
  14.  
  15. iff "%[%@ascii[a]]"=="1" then^alias global `*global/qhi`^alias dir `*dir/a`^endiff
  16.  
  17. REM I could use a NOP command. cd . is best substitude I could find..
  18. REM Note: Total reports disk usage only for files it can see (use -a for all).
  19. iff "%[%@ascii[t]]"=="1" then^alias echo `cd .`^alias echos `echo`^alias screen `echo`^endiff
  20.  
  21. :over
  22. set here=%_cwps^unset/q total
  23.  
  24. REM We want to study some other directory. False input discarded.
  25. iff "%1" != "" then
  26.     iff isdir %1 then
  27.         cd %1
  28.         if %_column != 0 echo.
  29.         iff "%@index[%_cwps,%here]"=="-1" then
  30.             echo [%@upper[%_cwds]]
  31.         else
  32.             echo [.\%@substr[%sub,%@len[%here]]]
  33.         endiff
  34.     endiff
  35. endiff
  36.  
  37. global/qi gosub work^cd -^goto raportti
  38.  
  39. :work
  40. echo %_cwp|set plaza=%@line[con,0]
  41. iff "%@index[%_cwps,%here]"=="-1" then
  42.     echos %_cwds
  43. else
  44.     echos .\%@substr[%plaza,%@len[%here]]
  45. endiff
  46. dir/ku|set b=%@line[con,0]^set a=2
  47.  
  48. :loop
  49. iff %@word[-%a,%b]==file(s) then
  50. iff %@eval[%_column+%@len[%space]] lt 48 then^screen %_row %@eval[51-%@len[%space]]
  51. else^echos `  `^endiff
  52. echo %space^set total=%@eval[%total+%td]^unset/q space td^return^endiff
  53. set space=%@word[-%a,%b] %space^set td=%@word[-%a,%b]%td^set a=%@eval[%a+1]
  54. goto loop
  55.  
  56. :raportti
  57. unalias *
  58. screen %_row 0 Total:^screen %_row %@eval[51-%@len[%total]-%@int[%@eval[%@len[%total]/3]]]
  59. set plaza=%@eval[%@len[%total]%%3]^echos %@substr[%total,,%plaza]
  60. for %a in (0 3 6 9) echos ` `%@substr[%total,%@eval[%plaza+%a],3]
  61. screen %_row 52 Bytes Allocated
  62.  
  63. shift^if "%1"=="" goto end^goto over
  64.  
  65. :info
  66. echo Usage: %@lower[%@name[%0]] [-at?] [directory list]
  67. text
  68.  
  69.     -a    all files and directories (hidden, system)
  70.     -t    only grand total (slow)
  71.     -?    info
  72. endtext
  73.  
  74. :end
  75. break off^quit
  76.