delete-file-or-directory()
This function deletes single or multiple files (and possibly directories) in the local file system. The directory under which the files are located is specified in a.
Parameter b has to specify the file name pattern. If parameter c is "true", directories that match name b are deleted as well. If those directories contain files, they will all be deleted (recursively) beforehand.
The return value is "true" if the deletion was successful (everything has been deleted) and no errors have occurred. If individual files/directories cannot be deleted because of missing access rights, they will be skipped. The return value is then "false". If the directory specified in parameter a does not exist or the access rights do not allow deletion in it, false is returned. Each individual file is entered in the job log, either as successfully deleted or as an unsuccessful deletion attempt. If, according to parameters a and b, there are no files to delete, true is returned (since the goal that the specified files do not exist has been reached without error).
Note: In a mapping test, the deletion is only simulated.
Parameters
Parameter |
Description |
a |
Parent directory under which to delete, relative or absolute. The parent directory itself is never deleted. A slash "/" is used as path separator. Shares (Samba/Windows) are not accepted, even if they are entered in the whitelist. Parameter a must be contained in a whitelist (defined system-wide in ./etc/admin/datawizard/whiteListPaths.properties). If this is not the case, the function terminates with an error. However, the check only takes place if this list exists and contains at least one entry. Attention: Otherwise, the deletion will be done without checking the permissions. |
b |
File name pattern (may contain placeholders "*" and "?"). You can also use a regular expression with prefix "regex:". You cannot use path separators "/" or "\". Note: The file name pattern is case-sensitive, even under Windows. |
c |
(optional) If "false", only files under directory a are deleted, no directories. If "true", directories that match b are deleted as well. If those directories contain files, they will all be deleted (recursively) beforehand. |