###sysinclude dir.uh ###sysinclude stringextra.uh ###define COLORS // delete the COLORS directive above if you do not want colored output! { „vonal” __usebigbossnamespace myself "-" 90 makestring() } { „points” __usebigbossnamespace myself "." 60 makestring() } #g argc 3 < { "." }{ 2 argv } sto mypath @mypath 'd !istrue { ."The give directory doesn't exist! Exited.\n" end } @mypath getdir { ."Cannot load the dir! Aborted.\n" end } sto mydir @mydir ~d { ."Directories:\n" @mydir ~d {| #s @mydir 'd {} octalrights dup print free SPACE @mydir 'd {} getfilename dup 37 stub print SPACE drop @mydir 'd {} groupname ': !+ @mydir 'd {} ownername dup sto temp + dup 10 stub print free @temp free @mydir 'd {} mtime dup print free NL |} @points sprint @mydir ~d { ."Total: " @mydir ~d #g print ." subdirectories.\n" } @vonal sprint } @mydir ~r { ."Regular files:\n" @mydir ~r {| #s @mydir 'r {} octalrights dup print free SPACE @mydir 'r {} getfilesize sbr §ifcolored @mydir 'r {} executable { ." >" }{ ." " } SPACE @mydir 'r {} getfilename dup 37 stub print SPACE drop @mydir 'r {} groupname ': !+ @mydir 'r {} ownername dup sto temp + dup 10 stub print free @temp free @mydir 'r {} mtime dup print free NL |} @points sprint @mydir ~r { ."Total: " @mydir ~r #g print ." regular files. " ."TotalSize = " @mydir 'r totalsize sbr §ifcolored NL } @vonal sprint } @mydir ~L { ."Symlinks:\n" @mydir ~L {| #s @mydir 'L {} octalrights dup print free SPACE @mydir 'L {} executable { .">" }{ SPACE } SPACE @mydir 'L {} getfilename dup 67 stub print SPACE drop @mydir 'L {} broken { ."--->" }{ ."===>" } SPACE @mydir 'L {} destination dup 30 stub print drop NL |} @points sprint @mydir ~L { ."Total: " @mydir ~L #g print ." symlinks.\n" } } @vonal sprint ."Size, alltogether = " @mydir alltotal sbr §ifcolored NL @vonal sprint @mydir free ."Free spaces: /* Total size of the filesystem is : " @mypath filesystemsize dup sto filsize sbr §ifcolored ." */\n" ." for non-privilegized use: " @mypath freenonpriv dup sbr §ifcolored #g 100 * @filsize / ." ( " print ."% ) " NL ." All available free space: " @mypath totalfree dup sbr §ifcolored #g 100 * @filsize / ." ( " print ."% ) " NL end ifcolored: ###ifdef COLORS coloredsize ###endif ###ifndef COLORS #g !(#s) 21 >| ###endif dup sprint free rts { „filsize” } { „mydir” } { „mypath” } { „temp” } { „makestring” #s * dup 10 !+ swap free #g = }