HPlogo Commands Reference HP 3000 Series 9X8LX Computer Systems > Chapter 2 MPE/iX Commands

PURGEDIR

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Purges (unlinks) one or more directories.

Syntax



   PURGEDIR [dir=]dir_name [; CONFIRM | NOCONFIRM ]

   [; TREE | NOTREE | USENAME ] [; SHOW | NOSHOW]

   [; SHOWERRORS | NOSHOWERRORS]

Parameters

dir_name

The name of the directory that is being purged (required). The dir_name is assumed to be an MPE name. HFS-named directories may be purged if dir_name starts with a dot (.) or a slash (/). If dir_name is an HFS name and ends in a slash, then all objects at all levels under and including dir_name are purged, unless the NOTREE option is specified. The use of wildcards is permitted. The dir_name cannot name root (/), an MPE group, or an account.

USENAME

This default option indicates that dir_name alone controls whether or not all levels of directories and files are deleted. 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.

TREE

Causes all objects below and including dir_name to be purged. 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

Causes dir_name only to be purged 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 (/).

CONFIRM

Causes a prompt that asks 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

Causes the purge of dir_name (and all objects under it for TREE purges) without the need to prompt. NOCONFIRM is the default for jobs.

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.

SHOWERRORS

Causes each lower-level error that prevents an object below dir_name from being deleted, to be displayed on $STDLIST. The object (file or directory) name is shown, followed by the error message. By default, lower-level errors are not displayed.

NOSHOWERRORS

Suppresses the display of low-level errors. NOSHOWERRORS is the default.

Use

You can issue the PURGEDIR command from a job, a session, a program, or in break mode. 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.

You can also use wildcards with the PURGEDIR command. For examples of using wildcards with PURGEDIR, refer to the Example section.

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 causes each purged file and directory name to be displayed 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 causes any error that prevents an object from being deleted to be displayed to $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@/

The following examples show how to use wildcards with PURGEDIR.

To delete a directory and the files or directories it contains using wildcards:

  • Use the PURGEDIR command. For example:

       :purgedir /MYACCT/MYGRP/@
    

    This example deletes all directories rooted to /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, and all objects below these directories:

       :purgedir TMP@; TREE
    

    To delete all directories under the CWD with names ending with TMP, and 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 Commands



   CHDIR

   LISTFILE

   NEWDIR

   PURGE

   PURGEACCT

   PURGEGROUP

   LISTDIR (UDC)

   FINDDIR (UDC)
Feedback to webmaster