The File System

The File Life Cycle

This section describes how you can create new files, copy existing files, and delete obsolete files. Four commands are discussed:

Creating Files: The CREATE Command

Files can be created in several ways: text can be entered from the keyboard via the CREATE command, an editor can create a file, as can a running program, and files can be copied from other directories. This section explains use of the CREATE command. Editors are described in Chapter 4.

Before creating too many files, keep in mind that disk quotas are imposed on Science Cluster users. If you exceed your disk quota, you will be able to finish your current session using an overdraft allocation, but will be unable to create any new files until you delete enough files to bring you back within your quota. See "Managing Your Disk Space" on page 51 for more information about disk quotas.

The VMS CREATE command is used to take keyboard input and store it directly to a file. The command requires a file name as a parameter, but will prompt you if you don't enter it on the command line. Once the command is entered, everything you type goes in the file until you press - to close the file (or - or - to abort). Figure 3.2 shows how to create a file called MYPAPER.TXT; notice that the file is immediately opened and input goes in the file.

Figure 3.2: Creating a File

If you notice a mistake before pressing , then you can correct it with the key, otherwise you will have to wait until the file is closed and then re-open it with a text editor (such as DECTPU or Emacs) and correct the mistake. If you press - while entering a line, the entire line is deleted.

Duplicating a File: The COPY Command

The COPY command duplicates a file; it is usually used to either make a copy of a file giving it another filename, or to copy a file from one directory to another. COPY takes two parameters: the name of the original file (including directory name), and the name of the new file.

To simply make a copy of an existing file in the current directory, for example, to make a working copy of some source code while preserving the original copy, you could use the following command:

The following command shows how to copy a file from another directory to the current directory.

The highest version number will be used if none is specified. Copying files between nodes on a network is discussed on page
152. Additional information about the COPY command is available in the online help.

Changing File Names: The RENAME Command

File names can be changed with the RENAME command. This command takes two arguments: the old file name, and the new file name. For example:

If you type RENAME without any arguments, the system will prompt you for the old and new file names. You must have delete privileges for the file you want to rename. (File protections are described on page
54.) In the example above, no version number was specified. In this case, the highest version number is used.

The RENAME command does not work across disks. Use the COPY command for this. For example, the following command will not work:

Removing a File: The DELETE Command

This section explains how to eliminate unwanted files that can quickly clutter your account. When you type a DIRECTORY command, you may see several files that you no longer need. To delete obsolete files, use the DELETE command followed by a file name or file name template (wildcards). For example:

Notice that a version number is included. You must specify which version of a file is to be deleted. If you want to delete every version of a file, then use the wildcard character, for example:

As with other commands, the DELETE command has many options. A full description of these options can be obtained through the online help facility by typing:

One of the most useful options is the /CONFIRM qualifier. This gives you a chance to change your mind. The following command shows how the CONFIRM option is specified:

The system will respond with a message listing the directory, file name, date created, and other information about each the file it is ready to delete. You then type either YES or NO (abbreviated to y or n) in response to the message. YES will delete the file, NO will retain the file. This command is exceptionally useful when deleting a large number of files at once. The DELETE/CONFIRM sequence may be safely aborted at any time by pressing - .

Many VMS commands create temporary files. These files usually carry the file type .TMP. These files can be safely deleted at the end of a terminal session.

When you are cleaning your directories, keep in mind that the PURGE command can be used to delete all old versions of files (see "Removing Multiple Versions of Files: PURGE" on page 53).

Creating Files: The CREATE Command
Figure 3.2: - Creating a File
Duplicating a File: The COPY Command
Changing File Names: The RENAME Command
Removing a File: The DELETE Command

Generated with CERN WebMaker