pc:DeleteDirectories

Previous Next

Deletes one or more specified directories and their contents and (if specified) their subdirectories.

Syntax

<pc:DeleteDirectories>
     <Directory dirpath="folder-pathrecursive="recursive"/>
     ...
</pc:DeleteDirectories>
 
recursive  :=  { yes | no }

The required dirpath is a path identifying, in each case, the folder to be deleted.

If recursive is set to "no" (the default), and the folder contains at least one file or subdirectory, then the operation fails and returns the error message "The directory is not empty". In the latter case, if you have other <Directory> elements, the delete operation fails also for those other elements.

If recursive="yes" is passed, then files and subdirectories contained by the folder (if any) are automatically deleted along with the folder itself.

If recursive="no" (the default), and the folder contains at least one file or subdirectory, then the operation fails and returns the error message "The directory is not empty". In this case, if you have other <Directory> elements, the delete operation fails also for those other elements.

Example

<pc:DeleteDirectories>
     <Directory dirpath="{$serverdir}" recursive="yes"/>
     <Directory dirpath="{path:Combine($serverdir, '..', 'help')}" />
</pc:DeleteDirectories>