HPlogo MPE/iX Commands Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 6 Command Definitions P-R

PURGEDIR

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Purges (unlinks) one or more directories.

Syntax

PURGEDIR [dir=] dir_name
[{ ;TREE ;NOTREE ;USENAME }] [ { ;CONFIRM ;NOCONFIRM ;CONFIRMALL }]
[ { ;NOSHOW ;SHOW }] [{ ;SHOWERROR ;NOSHOWERROR }]

Parameters

dir_name

The name of the directory that is being purged (required). The dir_name is assumed to be an MPE name unless you begin it with a dot (.) or a slash (/) to indicate an HFS directory.

If dir_name is an HFS directory that ends in a slash and you don't include the NOTREE option, PURGEDIR deletes all objects at all levels under and including dir_name.

The use of wildcards is permitted. The dir_name cannot name root (/), an MPE group, or an account.

TREE

Purges all objects below and including dir_name. The dir_name may or may not end in a slash (/), with no error or warning reported. Since the MPE naming convention does not support a trailing slash (/), the TREE option is the only way to delete a non-empty, MPE-named directory with a single command.

NOTREE

Purges dir_name only if it is empty. If dir_name is an HFS name and ends in a slash (/), a warning tells you that NOTREE overrides the trailing slash (/).

USENAME

Indicates that dir_name alone controls whether or not all levels of directories and files are deleted. (This is the default.) If dir_name is an HFS name and ends in a slash (/), then it, and all objects under it are deleted. If dir_name does not end in a slash (/), then only dir_name is purged, assuming it is empty. USENAME only applies to HFS-named directories, and is ignored for MPE-named directories.

CONFIRM

Requires the user to confirm the purge of the directory. A different prompt is seen depending on whether dir_name is to be purged with the TREE option or with the trailing slash feature. CONFIRM is the default for sessions. CONFIRM is ignored for jobs.

NOCONFIRM

Purges dir_name (and all objects under it for TREE purges) without user confirmation. NOCONFIRM is the default for jobs.

CONFIRMALL

Requires the user to confirm each directory before the purge is executed. A proper response is one of the following:

  • "Y" or "YES" to purge the directory

  • "N", "NO", or Return to retain the directory

  • "Q", "QUIT", or Break to stop the PURGE command

The CONFIRMALL option is ignored in jobs and when you are purging a single directory.

SHOW

Displays to $STDLIST each file or directory under dir_name that was purged. Directory names are always displayed in an HFS syntax, even if the name was specified as an MPE name.

NOSHOW

Suppresses the display of each file and directory purged. NOSHOW is the default.

SHOWERROR

Displays on $STDLIST each lower-level error that prevents an object below dir_name from being deleted'. The object (file or directory) name is shown, followed by the error message. By default, lower-level errors are not displayed. SHOWERRORS is a synonym for SHOWERROR.

NOSHOWERROR

Suppresses the display of low-level errors. NOSHOWERROR is the default. `NOSHOWERRORS'' is a synonym for NOSHOWERROR.

Use

You can issue the PURGEDIR command from a job, a session, a program, or in BREAK. Pressing Break terminates execution of this command. You must have TD access to each component in the dir_name pathname, and DD permission to the parent directory of dir_name. (Refer to the ALTSEC command for more information on directory access.) If wildcards are specified with dir_name, then RD access is required to the parent directory of each wildcard component. If the purge is multilevel, then TD, RD and DD accesses are necessary to each directory below dir_name.

Operation

The PURGEDIR command purges the directory dir_name. The dir_name cannot name an MPE account, an MPE group, a file, or root (/). Dot (.) and dot-dot (..) can be specified but cannot be purged.

By default PURGEDIR deletes an MPE-named directory. This means that dir_name must follow all MPE naming rules, unless it is prefixed with a dot (.) or a slash (/). Since the MPE name syntax defines three levels, fully (or partially) qualified MPE-named directories can only be created under MPE groups. Unqualified MPE-named directories are created relative to the CWD. Directories do not support lockwords, file equations, or system defined file names (for example, $NEWPASS). If dir_name begins with a dot (.) or a slash (/), then HFS naming rules are enforced.

The directory referenced by dir_name must be empty (except for dot (.) and dot-dot (..)) in order to be purged, unless a TREE purge is requested. A TREE purge may be requested as follows:

  1. Specify the TREE option. (The dir_name parameter does not control a multilevel purge in this case). This is the only choice available if dir_name is an MPE name.

  2. If dir_name is an HFS name, ends in a slash (/), and the ;NOTREE option is not requested, then a TREE purge occurs.

The dir_name parameter cannot reference root (/) because purging root is undesirable, and most likely is not what is intended.

A file or directory is not deleted if it is being accessed (opened); however, all non-accessed objects under dir_name are still purged. A final "IN USE" error indicates that dir_name was not deleted because one or more children objects could not be removed.

If CONFIRM is specified while your session is interactive, and it is legal for you to purge dir_name, then you are prompted to confirm the purge of dir_name. If a NOTREE purge is requested, the following prompt is displayed:

       DIRECTORY dir_name TO BE PURGED? (YES/NO)_

Valid responses are YES, Y, NO, and N (case insensitive). If a TREE purge is requested, the prompt is:

       PURGE ALL FILES BELOW AND INCLUDING dir_name? (ALL/NO)_

Valid responses are ALL, NO, and N (case insensitive).

NOTE: If dir_name is long, the prompt may wrap around. If dir_name is an MPE name, it is fully qualified in the prompt message. If the YES option is selected, then the purge is automatically confirmed without a prompt.

The SHOW option displays the name of each purged file and directory on $STDLIST. For example:

  PURGEDIR ./mydir ;TREE ;SHOW
./mydir/abc
./mydir/dir1/dir2/file1
./mydir/dir1/dir2/file2
./mydir/dir1/dir2
./mydir/dir1/f1
./mydir/dir1/f2
./mydir/dir1
./mydir/file1
./mydir

The SHOWERRORS option displays any error that prevents an object from being deleted on $STDLIST after the object name is displayed. Object names are only displayed if an error occurs.

Examples

The following examples purge dir1, which is empty.

             PURGEDIR /MYACCT/MYGRP/dir1
PURGEDIR /MYACCT/MYGRP/dir1;NOTREE

PURGEDIR /MYACCT/MYGRP/dir1/;NOTREE
NOTREE option overrides directory name ending in a "/". (CIWARN 9041)

The following examples purge dir1 and all objects below dir1.

  PURGEDIR /MYACCT/MYGRP/dir1/
PURGEDIR /MYACCT/MYGRP/dir1 ;TREE

The next example shows the command to purge MYDIR.

  PURGEDIR mydir

The next example shows the command to purge MYDIR and all objects below.

  PURGEDIR mydir;TREE

The next example illustrates the SHOW and TREE options.

  PURGEDIR dir;SHOW;TREE
./DIR/A
./DIR/B
./DIR/dir1/A
./DIR/dir1/B
./DIR/dir1
./DIR/C
./DIR

PURGEDIR /dir1/dir2;SHOW;TREE
/dir1/dir2/file1
/dir1/dir2/file2
/dir1/dir2

PURGEDIR ./foo/;show
./foo/dir1_below_foo/f1
./foo/dir1_below_foo/f2
./foo/dir1_below_foo
./foo

The following command purges all empty directories under the CWD with TMP in their name.

  PURGEDIR @tmp@

The following command purges all directories under the CWD with names beginning with TMP, and all objects below these directories.

  PURGEDIR tmp@;TREE

The following command purges all directories under the CWD with names ending with tmp, and all objects below these directories.

  PURGEDIR ./@tmp/

The following command purges all empty directories rooted to /a/b.

  PURGEDIR /a/b/@

The following command purges all directories rooted to CWD/a@/b@ and all objects below these directories.

  PURGEDIR ./a@/b@/

You can use the PURGEDIR command to delete a directory and the files or directories it contains using wildcards. For example, to delete all directories rooted to MYACCT/MYGRP enter:

  :purgedir /MYACCT/MYGRP/@

To delete all empty directories under the CWD (Current Working Directory) with TMP in their name:

  :purgedir @TMP@

To delete all directories under the CWD with names beginning with TMP all objects below these directories:

  :purgedir TMP@; TREE

To delete all directories under the CWD with names ending with TMP all objects below these directories:

  :purgedir ./@TMP/

When wildcards are specified with dir_name, then RD access is required to the parent directory of each wildcard component. If the purge is multilevel, then TD, RD, and DD accesses are necessary to each directory below dir_name.

Related Information

Commands

CHDIR, LISTFILE, NEWDIR, PURGE, PURGEACCT, PURGEGROUP, LISTDIR (UDC), FINDDIR (UDC)

Manuals

None

Feedback to webmaster