home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
batnmore.z!p
/
DUS.BTM
< prev
next >
Wrap
Text File
|
1992-11-15
|
2KB
|
76 lines
*REM This batch file is Freeware, free to use and redistribute unmodified *
*REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
REM Show disk usage subdirectorycally (sp.)
REM Timestamp 15-Nov-1992
break on^setlocal^unalias *^unset *^if "%1"=="-?" goto info
if "%@ascii[%1]"=="45" goto optiot^goto over
:optiot
set plaza=%@eval[%plaza+1]^set %@ascii[%@substr[%1,%plaza,1]]=1
if %plaza lt %@eval[%@len[%1]-1] goto optiot^shift
iff "%[%@ascii[a]]"=="1" then^alias global `*global/qhi`^alias dir `*dir/a`^endiff
REM I could use a NOP command. cd . is best substitude I could find..
REM Note: Total reports disk usage only for files it can see (use -a for all).
iff "%[%@ascii[t]]"=="1" then^alias echo `cd .`^alias echos `echo`^alias screen `echo`^endiff
:over
set here=%_cwps^unset/q total
REM We want to study some other directory. False input discarded.
iff "%1" != "" then
iff isdir %1 then
cd %1
if %_column != 0 echo.
iff "%@index[%_cwps,%here]"=="-1" then
echo [%@upper[%_cwds]]
else
echo [.\%@substr[%sub,%@len[%here]]]
endiff
endiff
endiff
global/qi gosub work^cd -^goto raportti
:work
echo %_cwp|set plaza=%@line[con,0]
iff "%@index[%_cwps,%here]"=="-1" then
echos %_cwds
else
echos .\%@substr[%plaza,%@len[%here]]
endiff
dir/ku|set b=%@line[con,0]^set a=2
:loop
iff %@word[-%a,%b]==file(s) then
iff %@eval[%_column+%@len[%space]] lt 48 then^screen %_row %@eval[51-%@len[%space]]
else^echos ` `^endiff
echo %space^set total=%@eval[%total+%td]^unset/q space td^return^endiff
set space=%@word[-%a,%b] %space^set td=%@word[-%a,%b]%td^set a=%@eval[%a+1]
goto loop
:raportti
unalias *
screen %_row 0 Total:^screen %_row %@eval[51-%@len[%total]-%@int[%@eval[%@len[%total]/3]]]
set plaza=%@eval[%@len[%total]%%3]^echos %@substr[%total,,%plaza]
for %a in (0 3 6 9) echos ` `%@substr[%total,%@eval[%plaza+%a],3]
screen %_row 52 Bytes Allocated
shift^if "%1"=="" goto end^goto over
:info
echo Usage: %@lower[%@name[%0]] [-at?] [directory list]
text
-a all files and directories (hidden, system)
-t only grand total (slow)
-? info
endtext
:end
break off^quit