REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


The function SysDestroyObject


Use the REXXUTIL function <SysDestroyObject to delete a complete directory 
tree including the sub directories (Source: Michael Platschek (see EMail 
Addresses)). 
Please note that this is not possible if there are read-only files in one 
of the directories. To get around this limitation you can use the function 
<SysFileTree (see also Delete a directory(-tree)): 

 
/* sample code to delete a directory tree                             */

                    /* dirToDelete contains the name of the directory */
                    /* to delete                                      */
  dirToDelete = 'D:\TEST'

                    /* load the functions from the DLL REXXUTIL       */
  call rxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  call SysLoadFuncs

                    /* clear the read-only, the hidden and the system */
                    /* flag from all files                            */
  call SysFileTree dirToDelete || '\*.*', dummyStem, 'BS', '*****', '-*---'

                    /* delete the directory tree                      */
  call SysDestroyObject dirToDelete

  

Inf-HTML End Run - Successful