HPlogo New Features of MPE/iX: Using the Hierarchical File System: 300 MPE/iX Computer Systems > Chapter 6 Managing Directories

Deleting Directories

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Use the PURGEDIR command to delete a hierarchical directory. MPE-Escaped naming rules apply.

You cannot use PURGEDIR to delete an account, an MPE group, the root directory, or a file. You will receive an error message if you try. Although you can specify (.) and (..) in the PURGEDIR command, you cannot delete these directories.

You must have traverse directory entries (TD) access to the directory you want to delete and any other directories referenced in the pathname. You must have delete directory entries (DD) access to the parent directory of the directory you are deleting.

Deleting empty directories

To delete a directory that is empty:

  • Use the PURGEDIR command. For example:

    :purgedir /MYACCT/MYGRP/dir1
    
    Directory "/MYACCT/MYGRP/dir1" to be purged? (Yes/No)y
    

    This example deletes dir1.

If the directory that you are trying to delete is not empty, you receive an error message and it is not deleted. In the following example, dirwithfiles contains files.

:purgedir /MYACCT/MYGRP/dirwithfiles

Directory "/MYACCT/MYGRP/dirwithfiles" to be purged?

(Yes/No)y

Directory is not empty. No PURGEDIR done.

Consider using the ;TREE option. (CIERR 994)

Deleting directories that are not empty

To delete a directory that is not empty:

  • Use the PURGEDIR command with the TREE option, or specify a pathname ending in /. For example:

       :purgedir /MYACCT/MYGRP/dir1 ;TREE
    

    or

       :purgedir /MYACCT/MYGRP/dir1/
    

    Both of these examples perform the same action: they delete dir1 and any files or directories in dir1.

    You must have TD and DD access to dir1 and any directories in it to delete them. Specifying a slash at the end of a pathname or using the TREE option makes this a recursive deletion that starts from the bottom of the tree and works its way up the tree.

    If any of the files in the directory (or directories) are open when you execute the command, you receive an IN USE warning message. The directory that contains the open file and the open files are not deleted. All other files and directories are deleted.

Deleting using wildcards

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.

Feedback to webmaster