How to list directories on an OpenVMS volume

3.9k Views Asked by At

I've been searching Google as well as the OpenVMS System Administrator's Guide and User Guide, and still can't find anything regarding listing the directories present on an OpenVMS volume. I can't see how this could taken for granted in the docs, since everything else is very specific, so either I'm failing to see it or it can't be done. If it can't be done, then I'm missing some incredibly large chunk of the picture in regards to using VMS. Any suggestions are appreciated.

TIA, grobe0ba

3

There are 3 best solutions below

0
On

Unfortunately I do not have the reputation required for commenting so I have to reformulate the answer.

@ChrisB

This answer while voted is not correct generally speaking. Directories are always files ending with .DIR and having a version of 1. Renaming a directory to *.DIR;x with x>1 will render the directory not traverseval. The DIR file however retains its directory characteristics and renaming it back to ;1 will return its normal behavior.

So one may add a ;1 to the DIR command

$ dir volumeid:[000000...]*.dir;1

But again this is not valid because any one may create *.DIR files which are not directories (ex. EDIT TEST.DIR), and there are applications out there doing so.

@Hein

So the second answer from Hein, which at this time does have 0 votes, is the corretc one. The one that does exactely the requested operation without 3rd party tool is:

$ PIPE DIR /TOTAL volume:[*...] | SEARCH SYS$PIPE "ory "

This command will only show valid directories

0
On

For a quick overview of all the directories you may also check out the /TOTAL option for 'directory'.

$ DIRE /TOTAL [*...]

Add /SIZE for effect (and slowdown)

You can of course post process to your hearts content...

$ pipe dir /total data:[*...] | perl -ne "print if /^Dir/"
Directory DATA:[CDC]
Directory DATA:[CDC.ALPHA]
Directory DATA:[CDC.ALPHA.V8_3]
$ pipe dir /total data:[*...] | searc sys$pipe "ory "
Directory DATA:[CDC]
Directory DATA:[CDC.ALPHA]
Directory DATA:[CDC.ALPHA.V8_3]
$ pipe dir /total data:[*...] | perl -ne "chomp; $x=$1 if /^Di.* (\S+)/; printf qq(%-60s%-19s\n),$x,$_ if /Tot/"
    DATA:[CDC]                                                  Total of 7 files.
    DATA:[CDC.ALPHA]                                            Total of 1 file.
    DATA:[CDC.ALPHA.V8_3]                                       Total of 11 files.

Finally, if you are serious about playing with files and directories on OpenVMS, be sure to google for DFU OPENVMS ... download and enjoy.

0
On

By "listing", I assume you mean via a command such as Dir... To see all directories on a volume I would do something like,

$ dir volumeid:[000000...]*.dir

Of course, you need enough privilege to be able to see all the directories on the volume.