Operating System - OpenVMS
1752794 Members
6092 Online
108789 Solutions
New Discussion юеВ

rename path issue [ newbie question]

 
SOLVED
Go to solution
nipun_2
Regular Advisor

rename path issue [ newbie question]

Hi,
I am trying to move directory and it's subdirectories and all their contents from

disk1:[acct1.data]dirTOMOVE to
disk1:[ACCT2.data]dirTOMOVE

so I did
$rename disk1:[acct1.data.dirTOMOVE...]*.*;* disk1:[ACCT2.data]*.*;*

However, this copies the subdirectories directly to the data folder

so I have disk1:[ACCT2.data.subdir] instead of disk1:[ACCT2.data.dirTOMOVE.subdir]

Please let me know what you think

Thanks in advance

Nipun
20 REPLIES 20
John Gillings
Honored Contributor

Re: rename path issue [ newbie question]

Nipun,

You've got the answer in your description... Try:

$ RENAME/LOG -
DISK1:[ACCT1.DATA]DIRTOMOVE.DIR -
DISK1:[ACCT2.DATA]DIRTOMOVE.DIR

This will move the directory file (and all its contents). Good policy to use /LOG, especially if you're unsure what's going to happen.
Note that if ACCT1 and ACCT2 are owned by different users, you may want to reset the file ownerships as well:

$ SET DIRECTORY/OWNER=acct2 DISK1:[ACCT2.DATA.DIRTOMOVE]
$ SET FILE/OWNER=acct2 DISK1:[ACCT2.DATA.DIRTOMOVE...]*.*;*

A crucible of informative mistakes
Antoniov.
Honored Contributor

Re: rename path issue [ newbie question]

Just for talking,
directory in vms are file with .DIR extension.
Rename can work just on the same disk.

Antonio Vigliotti
Antonio Maria Vigliotti
Robert Gezelter
Honored Contributor

Re: rename path issue [ newbie question]

Nipun,

WADR (with all due respect), I believe that John omitted an important case in his answer.

John discussed the very common case of renaming a directory from one name to another. His answer is completely correct, as is his well noted comment about file ownership. To his comment, I will add a comment about the File Protection Masks and Access Control Lists (ACLS), which also may require adjustment, depending on your security issues.

John's answer, did however, omit the possibility that the RENAME operation was a merge of the files contained in disk1:[acct1.data...] with the contents of the directory tree disk1:[ACCT2.data...].

In that case, your RENAME command should be:
$ RENAME/LOG disk1:[acct1.data...]*.*;* disk1:[ACCT2.data...]*.*;*

Two things to note about the above:
- first, the ellipsis (...) on both source and the destination are critical
- the /LOG output will not include files (or for that matter, directories) that are included in sub-directories that are moved in total when the sub-directory is renamed.

Note that the use of RENAME only works for the same device, if the devices are different, BACKUP is the preferred utility.

I hope that the above is helpful.

- Bob Gezelter, http://www.rlgsc.com
Peter Quodling
Trusted Contributor

Re: rename path issue [ newbie question]

Use Backup - its much smarter at doing this sort of stuff...

Q
Leave the Money on the Fridge.
Robert Gezelter
Honored Contributor

Re: rename path issue [ newbie question]

Peter,

Yes, BACKUP is a good option. However, Nipun did not specify the size (or for that matter, the allocations) of the files in the original directory tree.

If the files are large, of they are specially allocated (e.g., contiguous, placement control), or if there is not enough space for two copies of the files on the disk, RENAME is Nipun's best option.

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

Re: rename path issue [ newbie question]

Backup is good solution when you have to move from a disk to another one.

Antonio Vigliotti
Antonio Maria Vigliotti
nipun_2
Regular Advisor

Re: rename path issue [ newbie question]

Thanks for the reply.
yeah I the files are huge and on the same disk so renaming is the only option I have and I have to be careful.

when I do
$ RENAME/LOG -
DISK1:[ACCT1.DATA]DIRTOMOVE.DIR -
DISK1:[ACCT2.DATA]DIRTOMOVE.DIR

Does this mean I need to have DIRTOMOVE.DIR already created in ACCT2 before hand?

in order to effectively copy all the subdirectories in the right order.
Antoniov.
Honored Contributor

Re: rename path issue [ newbie question]

Absolutely no,
ACCT2 can't exist, so can't exit its subdirectory.

Antonio Vigliotti
Antonio Maria Vigliotti
Hein van den Heuvel
Honored Contributor

Re: rename path issue [ newbie question]


>>> when I do $ RENAME/LOG -
DISK1:[ACCT1.DATA]DIRTOMOVE.DIR -
DISK1:[ACCT2.DATA]DIRTOMOVE.DIR
>Does this mean I need to have DIRTOMOVE.DIR >already created in ACCT2 before hand?

Yes.

You will also need to unprotect the directories before delete or rename as by default they are protected against delete.
Now you are not deleting, only writing, but changing directory entries can 'appear' to look like deleting (both cases can result in 'file not found' :-).
What I tend to do is a simple, sleazy: SET PROT xxx.DIR.
This will apply the default file protection which will allow delete.
You should reset afterwards, but you can not delete non-empty directories anyway.

Hein.