HPlogo New Features of MPE/iX: Using the Hierarchical File System: 300 MPE/iX Computer Systems > Chapter 6 Managing Directories

Using Symbolic Links

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

You have a lot of flexibility in naming directories and files by using symbolic links. What if you want to move a set of files from one location to another without affecting the normal processing of any application that accesses those files. To do this, you can move the actual files to the new location, and in the old location create symbolic links with the same name specifying the new location of the files.

Creating symbolic links

Suppose that files file1, file2, and file3 originally existed under the MPE group PXGROUP of account DEVELOP. You have decided to link the files to the /users/denis/bin/FILES directory. To ensure that all of the applications that access those files will still function properly, you can create symbolic links to those files in the old directory /DEVELOP/PXGROUP.

Use the NEWLINK command to create the symbolic links.

:rename ./file1, /users/denis/bin/FILES/file1

:rename ./file2, /users/denis/bin/FILES/file2

:rename ./file3, /users/denis/bin/FILES/file3

:chdir /DEVELOP/PXGROUP

:newlink ./file1, /users/denis/bin/FILES/file1

:newlink ./file2, /users/denis/bin/FILES/file2

:newlink ./file3, /users/denis/bin/FILES/file3

From this point on, anytime an application accesses these files by their old names, the symbolic links will redirect the file system to the new location of the files.

NOTE: This only applies to commands that operate on the target of the links and not the links themselves. For example, PURGELINK and STORE operate on the link itself and not the target files.

You can use this method to install newer versions of these files in another location without overlaying their current version, and changing the symbolic links to point to the newer version. If at any time you need to access the old version, you can point the symbolic links to that version of the files.

Deleting symbolic links

Use the PURGELINK command to delete a symbolic link.

:purgelink ./file1, /users/denis/bin/FILES/file1

The above example removes the symbolic link file file1 in the CWD.

Renaming symbolic links

Symbolic links can be renamed by calling the POSIX C-library function rename().

The MPE/iX RENAME command does not rename the symbolic link itself, it renames the file pointed to by the symbolic link. You can use the shell's MV command to rename a link.

Archiving symbolic links

Symbolic links can be stored and restored to your MPE/iX system by using the MPE/iX STORE and RESTORE commands like any other file on the system.

Feedback to webmaster