HPlogo Task Reference: HP 3000 Series 9X8LX Computer Systems > Chapter 2 Performing Tasks Using MPE/iX Commands

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 CWD(s) of the new location of the files.

To create symbolic links

A symbolic link is a type of file that contains another path name. It is a permanent file in the system directory. This concept is similar to MPE/iX file equations.

A symbolic link file may contain a relative or absolute path name. If a symbolic link to a relative path name is encountered during path name traversal, the contents of the symbolic link replace the symbolic link component and is expanded into the path name being interpreted. If a symbolic link to an absolute path name is encountered, the contents of the symbolic link replaces all components up to and including the symbolic link and is expanded into the remainder of the path name.

Creating symbolic links

Suppose that files file1, file2, and file3 originally existed under the group PXGROUP of account DEVELOP. You have decided to move 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 must create symbolic links to those files.

Use the NEWLINK command to create the symbolic links.

   :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, 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(s).

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

Renaming symbolic links

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

The MPE/iX command RENAME does not rename the symbolic link itself, it renames the file pointed to by the symbolic 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