The File System

Directories


A directory is a collection of files within a user's account (actually, it's a logical structure of files anywhere on the system, but we will focus here on how directories are used in your own user area). Most users have a single directory under which all files are grouped. More complex directory structures are possible, and are introduced briefly below.

Listing Directory Contents: DIRECTORY

Directories are most valuable simply to keep track of existing files. During a single terminal session you may create or change many files. Typing DIR at the system prompt will list all the files in the current directory. If there are no files in the current directory, the system will respond with the following message:

DIRECT-W-NOFILES, no files found
Many qualifiers are available for the DIRECTORY command. Table
3.2 lists some of the more useful qualifiers ; for information about other options, see the online help.

Table 3.2: DIRECTORY Qualifiers

Creating and Navigating Subdirectories

Directories imply a hierarchical structure with a common directory called the home or root directory and several layers of user-defined subdirectories. You can create directories for any type of data. For example, you may wish to have separate directories for your text documents, FORTRAN programs, and personal utilities.

Create a directory using the CREATE/DIR command. For example, to create a subdirectory in the current directory called FOR, you would type the following command:

$ CREATE/DIR [.FOR]
The directory will have the filename FOR.DIR. If you type DIR to see the contents of the directory, you should see the directory file. You can then move into that directory (i.e., make it your default) by typing:

$ SET DEFAULT [.FOR]
Note the syntax used in these commands. When creating a directory, you must enclose its name in brackets, and whenever you specify a subdirectory name you must precede its name with a period.

There are two special cases in navigating directories: you can always move to your root directory by typing SET DEF SYS$LOGIN, and you can move up one directory level by typing SET DEFAULT [-].


Do not edit or rename files that are directories (*.DIR). Doing so can orphan, or cause the file system to lose, files in that directory.


Deleting a Directory

A directory can be deleted using the DELETE command, just like you would delete a file, except that the directory must be empty (no files in it) and the protection on the .DIR file must be changed to allow deletion. The following steps will delete a directory:

  1. Move to the directory you want to delete using the SET DEFAULT command, for example:

   $ SET DEF [.OLDFILES]
  1. See if the directory is empty by using the DIRECTORY command.If the directory is empty, you will get the following message:

   % DIRECT-W-NOFILES, no files found
      $ DEL *.*;*

Before removing all files in a directory, check to make sure that you're in the correct directory, otherwise you could inadvertently delete the wrong files. Check the current directory by typing:
$ SHOW DEF


  1. Move up one directory level from the directory you want to delete.

   $ SET DEF [-]
  1. Set the protection on the directory to allow deletion.

   $ SET PROT=(O:D) OLDFILES.DIR;1
  1. Delete the directory.

   $ DELETE OLDFILES.DIR;1
Listing Directory Contents: DIRECTORY
Table 3.2: - DIRECTORY Qualifiers
Creating and Navigating Subdirectories
Deleting a Directory

Generated with CERN WebMaker