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

Directory Size

SOLVED
Go to solution
Alexandre Cruz_1
Occasional Visitor

Directory Size

Hi guys,

I would like to know if I can see the size of one specific directory, with several files and subdirectories in it. When I issue dir/size name_of_directory.dir, it will tell me the size of that particular file, without counting the other files inside it. An example of what I'm talking about is the right-click Properties option in MS Windows. It will give an output of directory size and how many files are inside.
8 REPLIES
Brian Reiter
Valued Contributor

Re: Directory Size

Something like

DIR /GRAND/SIZE

which returned

Grand total of 1 directory, 192 files, 910022 blocks

or for a directory tree

$ dir [...]/grand/siz

Grand total of 9624 directories, 54114 files, 8713116 blocks.

So you want

DIR [.name_of_directory...]/grand/siz

cheers

Brian
Robert Gezelter
Honored Contributor

Re: Directory Size

Alexandre,

WADR, DIRECTORY/SIZE/GRAND does not tell the entire story.

For example, consider the following output from one of my systems:

$ DIRECTORY/SIZE/GRAND
Directory SYS$SYSDEVICE:[GEZELTER]

Grand total of 1 directory, 313 files, 101628 blocks.

$ DIRECTORY/SIZE:ALL/GRAND
Directory SYS$SYSDEVICE:[GEZELTER]

Grand total of 1 directory. 313 files, 101628/101976 blocks.

The number before the "/" is the number of blocks actually containing data, the number after the "/" is the number of blocks allocated.

The cluster size from the above example is 3. On a disk volume with a larger cluster size, and a large number of smaller files, the differences can be quite dramatic. I have often seen differences of over 20% between the two numbers.

- Bob Gezelter, http://www.rlgsc.com
Alexandre Cruz_1
Occasional Visitor

Re: Directory Size

Thank you very much for your answers. Now the "Million Dollar question", picking your answers, I will be able to create a script that will give me the following output:

Directory
Size (used/allocated), number of directories and files

Subdirectories
Size (used/allocated), number of directories and files

With that I will be able to have a complete output.

If you know any script that can help, just let me know.
Karl Rohwedder
Honored Contributor

Re: Directory Size

If you need data on every subdirectoy you may use:

$ DIREC/SIZE/TOT [...]

which gives the data for each subdir as well as the grand total.

regards Karl
Robert Gezelter
Honored Contributor
Solution

Re: Directory Size

Alexandre,

I am not sure if it is worth USD $ 1,000,000.00, but:

$ DIRECTORY [...]/SIZE:ALL/TOTAL

Produces about what you requested. Note that the full range of the wildcard operations is possible, not just "[...]". One could also do the equivalent in DCL, processing one file at a time, if one wanted to for some other reason (gathering some other statistics or information about a collection of files).

- Bob Gezelter, http://www.rlgsc.com
marsh_1
Honored Contributor

Re: Directory Size

try :-

dir/siz/tot/full disk:[dir...]
Alexandre Cruz_1
Occasional Visitor

Re: Directory Size

All the answers provided me to find what I was searching. Kudos to all of you who helped me.
labadie_1
Honored Contributor

Re: Directory Size

try this for dsa2, for example

$! 'f$ver(0)
$ loop:
$ r = f$search("dsa2:[000000...]*.dir")
$ if r.eqs."" then exit
$ dev = f$parse(r,,,"DEVICE")
$ di = f$parse(r,,,"DIRECTORY")-"]"
$ name = f$parse(r,,,"NAME")
$! 'f$ver(1)
$ dir /gr/siz=all 'dev''di'.'name']
$! 'f$ver(0)
$ wait 00:00:02
$ goto loop