Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Proc to list directory sizes

Art Wiens
Respected Contributor

Proc to list directory sizes

Does anyone have a command procedure (or was it an executable), that would traverse a directory structure and report space consumption subtotals for all subdirectories on a given disk? I had one from ~4 or 5 years ago and I didn't write it. I seem to recall it was called DIRSPACE or something to that effect.

I have a "TREE" executable which is handy, but it only produces a display of the directory structure, and I don't have the source for it to possibly go in and hack it for size calculations.

I would appreciate if you could share it.

Thanks in advance,
Art
8 REPLIES
Antoniov.
Honored Contributor

Re: Proc to list directory sizes

Hi Art,
I don't know any commad procedure to do this.
I use a old DIR command as following:
DIRECTORY/SIZE/PAGE/TOTAL device
where device is your disk to examine.
You can add /PAGE do display one page at time and /OUT=filename to redirect to a file.

Bye
Antoniov
Antonio Maria Vigliotti
Antoniov.
Honored Contributor

Re: Proc to list directory sizes

Excuse me Art,
reading my post I see command is wrong written
Correct by:
DIRECTORY/SIZE/TOTAL device:[000000...]
i.e.
DIRECTORY/SIZE7TOTAL SYS$SYSDEVICE:[000000...]

Bye
Antonio Maria Vigliotti
Art Wiens
Respected Contributor

Re: Proc to list directory sizes

I understand that, but what I'm referring to was a procedure that would give totals for each subdirectory - eg. say you had
disk:[dir.subdir1.subdir2] it would come back and give file size totals:

disk:[dir] xx blocks
disk:[dir.subdir1] has xxx blocks
disk:[dir.subdir1.subdir2] has xxxx blocks

without listing all the files. I have a 180GB array with "many" subdirectories and a "tidy" listing of space consumption is what I'm after.

I guess I better get busy writing my own!

Thanks,
Art
Antoniov.
Honored Contributor

Re: Proc to list directory sizes

Hi Art
DIR/TOT don't display the content of a dir but only the total.
You can use /SIZE=ALLOC to calcolate allocated blocks or /SIZE=USE to calcolate used block.
Tyep HELP DIR for furthemore information.

HTH
Antoniov
Antonio Maria Vigliotti
Huc_1
Honored Contributor

Re: Proc to list directory sizes

Hello

Long time since I used vms but if I remember well

the following command is the one I used

$ spa/nowait dir/size=used/total/out=disk_usage.dat disk$whatever:[000000...]*

the result can be type/viewed from disk_usage.dat once the command is finished executing.

I dont have a vms to read the help from but I thing it is correct

Have a read at Help dir I am sure it could be made to meet your need,s

Whatever keep us informed ... tell me if my memory as faded..

Jean-Pierre
Smile I will feel the difference
Martin P.J. Zinser
Honored Contributor

Re: Proc to list directory sizes

Hello Art,

I do agree dir/tot is the closest you gonna get directly. You either need to wrap some DCL around it to get a one-line output like the Unix du.
If you do want to use a compiled langunage
Nope (simulated purge) should be a good start that only requires minor tweaks to turn it into a du clone.

Greetings, Martin

P.S. Nope is at http://www.decus.de:8080/www/vms/sw/nope.htmlx

Antoniov.
Honored Contributor

Re: Proc to list directory sizes

Hi Art,
Unix command du display as following
________________________________
nnnn /dir1
nnnn /dir1/dir2
________________________________

Vms DIR/TOT display as following
________________________________
DISK:[DIR1]

Total of xx files, nnnn blocks

DISK:[DIR1.DIR2]

Total of xx files, nnnn blocks
________________________________
It is very simble with a command procedure compact an output file.

Bye Antoniov
Antonio Maria Vigliotti
Alex Daniels
Frequent Advisor

Re: Proc to list directory sizes

Ok, This should give you what you want...

It defaults to the disk you are on, otherwise specify the disk you want as a param (with the colon)

eg: $ @ds dsa2:

$!
$ set nover
$ set noon
$ pipe dir 'p1'[000000...]/tot/siz | sea sys$input dir,tot/out=sys$login:ds.tmp
$ open/read/err=noop TMP sys$login:ds.tmp
$ loop:
$ read/error=eof tmp line
$ line1=line
$ read/error=eof tmp line
$ write sys$output line1+" "+line
$ goto loop
$!
$ eof:
$! Uncomment next line if you want the grand total as well
$! write sys$output line1
$ close tmp
$ delete sys$login:ds.tmp;*
$ exit
$!
$ noop:
$ write sys$output "Can not open temp file.."
$ exit %X10018292