1820390 Members
3489 Online
109623 Solutions
New Discussion юеВ

Deletion of a directory

 
SOLVED
Go to solution
GNJ
Advisor

Deletion of a directory

How to delete a directory recursively
including subdirectories and files
in OPENVMS?

Regards
Jayakrishnan
3 REPLIES 3
Duncan Morris
Honored Contributor

Re: Deletion of a directory

Hi Jayakrishnan,

there is no direct qualifier for recursive deletion.

You can either create your own script to examine the tree recursively, or use the wonderful DFU tool (essential requirement for all VMS system managers!):-

http://www.digiater.nl/dfu.html

This has a DELETE x.dir /DIR/TREE syntax which will do what you want.

Regards,

Duncan
Hein van den Heuvel
Honored Contributor
Solution

Re: Deletion of a directory

Agreed with the DFU suggestions.
You shoudl get that.

If it is just for once or twice then the workaround is:

$set prot [.test...]*.dir
$delete [.test...]*.*.*,*.*.*,*.*.*,*.*.*,*.*.*,*.*.*

It will complain about non-empty directories for the initial passes, but it will nail them all eventually :-).


Cheers,
Hein.
Hoff
Honored Contributor

Re: Deletion of a directory

GNV bash rm -R

DFU -- well worth the install, not just for this, but for its many other capabilities.

There are various deltree tools and procedures around, as well.

http://www.decus.org/libcatalog/description_html/v00148.html
http://vms.tuwien.ac.at/freeware/DELTREE/
http://vms.process.com/ftp/vms-freeware/fileserv/

If you're talking about coding this into an application, a depth-first tree search using lib$find_file and lib$delete_file calls. And a trailing lib$find_file_end call, as required, to clean up. Some of the Freeware tools likely use these calls, though some may use the lower-level RMS or XQP calls.

The brute-force approach is to repeat the parameter on the DCL command DELETE (with as many or more repeats as the directory is deep), or to repeat the DELETE command.

Stephen Hoffman
HoffmanLabs