PreviousNext

Deleting a Nonreplicated Directory

To delete a directory that has no replicas, use the dcecp utility's directory delete command. For example, to delete the directory /.:/sales, all of its immediate contents, and the contents of any of its child directories, you would enter:

dcecp> directory delete /.:/sales -tree
dcecp>

Note: Be careful when using the -tree option of the directory delete command. The command does not ask you confirm that you want to delete the directory that you specify in the command line; it proceeds immediately with the delete operation. This can result in the loss of directories that you want to keep.

Remember that you can change the behavior of dcecp commands through scripts. In the case of the directory delete command, you could write a script that prompted for a confirmation of the delete operation whenever the command was run with its -tree option. See Part 1 of this guide for a discussion of writing scripts.

A way to guard against the inadvertent deletion of directories and their entries is to view the contents before you run the directory delete command. To display the contents of a CDS directory by entry type, use the directory list command with the -object, -link, and -directory options.

The following is an example in which a directory named /.:/sales is deleted. The directory has one object entry and one soft link:

dcecp> directory list /.:/sales -simplename

work_disk link1

dcecp> directory list /.:/sales -simplename -object

work_disk

dcecp> directory list /.:/sales -simplename -link

link1

dcecp> directory delete /.:/sales -tree

dcecp> directory show /.:/sales

Error: Requested entry does not exist

dcecp>

If a directory to be deleted is not empty, the directory delete command will fail. To recover from this kind of failure, you must remove all the entries in the directory and its child directories, then run the directory delete command again. Use the link delete and object delete commands to delete the soft links and object entries in any directories. Then run the directory delete command to delete the directories.