directory delete, directory delete all, directory delete silently
These functions delete specified directories (including their files) and come in following flavors:
directory delete will assert an exception if the directory cannot be deleted (e.g. directory not found, directory not empty, access restrictions, etc.) Execution will stop immediately.
directory delete silently will delete the directories until a first failure is encountered. In this case, the applicable one of the short error messages on directories and files
will be returned. If no errors have been encountered, "OK" will be returned.
directory delete all tries to delete all directories and skips the ones which cannot be created. Here, the number of successfully deleted directories will be returned.
Indirect parameter passing is enabled.
Wildcards are not supported here
Min 0
No. | Type | Description |
---|---|---|
1, etc. input |
string | directory name Specify directory name. Add path name in front if needed. With indirect parameter passing enabled, the directories to delete can also be provided in one set. Example: directory delete( { directory1, directory2, .. } ); |
Type | Description |
---|---|
numeral or string | Feedback directory delete: Always "OK", because all errors cause exceptions. |
Directory not found
Directory not empty
Directory not accessible
Attempting to delete a file
file copy ( {3 : Example_Program.b4p}, { Test123.txt, Test456.txt, Test789.txt } );
print( file delete all ( Test123.txt, TestXXX.txt, Test456.txt ), " / " ); // Returns 2
print( file delete ( Test789.txt ), " / " ); // Returns OK
echo( file delete silently ( Test789.txt )); // Returns "File not found"
files[] = { Test123.txt, Test456.txt, Test789.txt };
file copy ( {3 : Example_Program.b4p}, files[] );
echo( file delete all ( files[] ) ); // Returns 3
2 / OK / File not Found
3
rm
rmdir
file delete ... Functions
directory delete multiple/recursive ... Functions