From:	SMTP%"MACRO32@WKUVX1.BITNET" 29-JUN-1993 14:27:18.72
To:	EVERHART
CC:	
Subj:	Re: File utility to see below 8 levels?

X-ListName: "VMS Internals, MACRO, & BLISS Discussions" <MACRO32@WKUVX1.BITNET>
Warnings-To: <>
Errors-To: MacroMan@WKUVX1.BITNET
Sender: MacroMan@WKUVX1.BITNET
From: <flowers@msuvx2.memst.edu>
Reply-To: MACRO32@WKUVX1.BITNET
X-Newsgroups: vmsnet.internals
Subject: Re: File utility to see below 8 levels?
Message-ID: <1993Jun29.124322.8377@msuvx2.memst.edu>
Date: 29 Jun 93 12:43:22 -0600
Organization: Memphis State University
Lines: 90
To: MACRO32@WKUVX1.BITNET
X-Gateway-Source-Info: USENET

In article <01GZYIQ5SY6Q0012XV@HEARNVAX.nic.SURFnet.nl>, DNW@NLR.NL writes:
>>I already knew that, but this isn't what I am looking for.  To give you
>>some background:  In a Pathworks environment, it is very easy for a PC
>>user to create subdirectories on a VMS file service (read: RMS disk)
>>as deep as 21 levels, with no error message being generated.  The
>>files below the 8th directory will not be backed up during incremental
>>passes, and restoring an entire disk (from an image backup) to retrieve files
>>is impractical.  Analyze/Disk does not report anything about these
>>directories below the 8th level.
>>
>>I just wanted to ensure nothing was publically available before re-inventing
>>the wheel in writing a program to do this.
>
> Maybe you can do the following algorithm:
>
> Rename all .dir files in level 8 subdir.
> Do BACKUP
> Rename all .dir files back to the directory they came from.

Actually, this might be a good place to use SET FILE/ENTER to enter the
directories under a top-level directory.

So, you've got:

DISK:[A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U]
DISK:[1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21]

Enter the files like so:

SET FILE/ENTER=DISK:[LEVEL8]I.DIR   DISK:[A.B.C.D.E.F.G.H]I.DIR
SET FILE/ENTER=DISK:[LEVEL8]9.DIR   DISK:[1.2.3.4.5.6.7.8]9.DIR
SET FILE/ENTER=DISK:[LEVEL15]P.DIR  DISK:[LEVEL8.I.J.K.L.M.N.O]P.DIR
SET FILE/ENTER=DISK:[LEVEL15]16.DIR DISK:[LEVEL8.9.10.11.12.13.14.15]16.DIR

There are three things you have to watch out for:

1) Changes in directory structure (additions, deletions, renames) will
   require updating the [LEVELn] directories.
2) Finding a unique name for the [LEVELn] directory files, since any of the
   level 8 directories might have the same file name; possibly appending the
   top level to the file name might be sufficient for your application.
3) Always use SET FILE/REMOVE to get rid of files in the [LEVELn] directories.

That said, now the files will be backed up in incremental backups, and you
don't break anything for Pathworks.  You can use a command procedure to do
most of the work for you; something like the following:

$       IF P1 .EQS. "" THEN INQUIRE P1 "Disk device"
$       IF P1 .EQS. "" THEN EXIT
$       P1 = P1 - ":" + ":"
$       TOPDIR = "*"
$       LEVEL = 8
$ LOOP:
$       CREATE/DIR/OWNER=[SYSTEM] 'P1'[LEVEL'LEVEL']
$ FIND_DIRS:
$       FILNAM = F$SEARCH("''P1'[''TOPDIR'.*.*.*.*.*.*.*]*.DIR",1)
$       IF FILNAM .EQS. "" THEN GOTO FINISHED_FIND
$       WRITE SYS$OUTPUT "Found " + FILNAM
$       DIR  = F$PARSE(FILNAM,,,"DIRECTORY","SYNTAX_ONLY") - "[" - "]"
$       IF F$LOCATE("LEVEL''LEVEL'",DIR) .EQ. 0 THEN GOTO FIND_DIRS
$       NAME = F$PARSE(FILNAM,,,"NAME","SYNTAX_ONLY")
$ ASK_NEW_NAME:
$       INQUIRE NEWNAM "Enter name for new entry [''NAME']"
$       IF NEWNAM .EQS. "" THEN NEWNAM = NAME
$       FULNAME = "''P1'[LEVEL''LEVEL']''NAME'.DIR;1"
$       WRITE SYS$OUTPUT "New entry: ''FULNAME'"
$       IF F$SEARCH(FULNAME,2) .EQS. ""
$       THEN    SET FILE/ENTER='P1'[LEVEL'LEVEL']'NAME'.DIR;1 'FILNAM'
$       ELSE    IF F$FILE_ATTRIBUTES(FILNAM,"FID") .NES. -
                   F$FILE_ATTRIBUTES(FULNAME,"FID")
$               THEN    WRITE SYS$OUTPUT "Another file already exists" +-
                                " by that name!"
$                       NAME = ""
$                       GOTO ASK_NEW_NAME
$               ENDIF
$       ENDIF
$       GOTO FIND_DIRS
$ FINISHED_FIND:
$       IF F$SEARCH("''P1'[LEVEL''LEVEL']*.DIR",3) .EQS. "" THEN GOTO FINISHED
$       TOPDIR = "LEVEL''LEVEL'"
$       LEVEL = LEVEL + 7
$       GOTO LOOP
$ FINISHED:
$       EXIT

Of course, I was just using this to play with the idea, so you'd probably
want to make some changes if you choose to implement this approach.
--
Harry Flowers                           Internet: FLOWERS@MSUVX2.MEMST.EDU
Memphis State University                & Bitnet: FLOWERS@MEMSTVX1
