directory delete multiple, directory delete multiple all, directory delete recursive, directory delete recursive all, directory delete recursive if empty
These functions delete multiple directories in specified directories. Wildcards are supported to select directories to delete.
directory delete multiple ... Only the directory / directories specified in 1st parameter will be considered to search and delete directories. Directories containing files will not be deleted.
directory delete recursive ... All subdirectories are also included for searching and deleting these directories. Files and subdirectories inside specified directories will be deleted.
directory delete ... all will try to delete all directories, skipping those which cannot be deleted. No exceptions asserted in this case.
The function directory delete recursive if empty will delete only those directories which are empty and ignore those containing files.
Attention: System files are not touched, but hidden files are. Directories containing such files will not be deleted.
Indirect parameter passing is disabled.
Wildcards are allowed on final directory names only
1-2
No. | Type | Description |
---|---|---|
1 input |
set or string | path name(s) Names of existing directory paths to delete. Nothing is deleted if the parameter is empty. If the parameter contains a blank string, then current the directory is assumed. If the 2nd parameter is not specified, then all files in the specified path are affected. |
Opt. 2 input |
set or string | directory name(s) or patterns If number of names or patterns in this function parameter equals to number of path names, then a 1:1 relationship is assumed, i.e.
1st path relates to 1st name, 2nd path to 2nd name, etc. If this parameter contains fewer elemeents, then the last element
will apply for the remaining path names. If this parameter contains more elements, then the excess names or patterns will be ignored. |
Type | Description |
---|---|
numeral | Number of directories deleted successfully Files inside directories will not be counted |
Directory not found
Directory not empty
Directory not accessible
Directory is a file
directory delete multiple( "D:\A", "*");
// Deletes all subdirectories in directory A if they are empty. The directory A will not be deleted.
// Deleting will stop when encountering first issue, e.g. non-empty or blocked directory.
directory delete multiple all ( "D:\A", "*");
// Same as above, but continues deleting the remaining directories in case of an issue
directory delete multiple( "", "A");
// Deletes subdirectory A if empty
directory delete recursive( "D:\A", "*");
// Deletes all subdirectories including their files and nested sub-directories in directory A. The directory A will not be deleted.
// Deleting will stop when encountering first issue, e.g. non-empty or blocked directory.
directory delete recursive all ( "D:\A", "*");
// Same as above, but continues deleting the remaining directories in case of an issue
directory delete recursive( "", "A"); directory delete recursive ("A"), directory delete recursive ("./", "A" )
// Deletes subdirectory A including their files and nested sub-directories in directory A
directory delete recursive if empty( "D:\A", "*");
// Deletes all subdirectories including their nested sub-directories in directory A if empty
// The directory A will not be deleted.
// This function implies '… all', meaning it tries to delete all existing subdirectories, even if an issue occurs.
directory delete recursive if empty ( "", "A");
// Deletes subdirectory A including their nested sub-directories in directory A if empty
directory delete ... Functions
file delete multiple/recursive ... Functions