The FILE_DELETE procedure deletes a file or empty directory, if the process has the necessary permissions to remove the file as defined by the current operating system. FILE_CHMOD can be used to change file protection settings.
Note: On UNIX, if a file to be deleted is a symbolic link, FILE_DELETE deletes the link itself, and not the file that the link points to.
In this example, we remove an empty directory named moose:
A scalar or array of file or directory names to be deleted, one name per string element. Directories must be specified in the native syntax for the current operating system.
If set, FILE_DELETE will quietly ignore attempts to delete a non-existent file. Other errors will still be reported. The QUIET keyword can be used instead to suppress all errors.
Set this keyword to cause FILE_DELETE to use the File argument exactly as specified, without applying the usual file path expansion.
FILE_DELETE will normally issue an error if it is unable to remove a requested file or directory. If QUIET is set, no error is issued and FILE_DELETE simply moves on to the next requested item.
By default, FILE_DELETE will refuse to delete directories that are not empty. If RECURSIVE is set, FILE_DELETE will instead quietly delete all files contained within that directory and any subdirectories below it, and then remove the directory itself.
Note: Recursive delete is a very powerful and useful operation. However, it is a relatively dangerous command with the ability to rapidly destroy a great deal of data. Once deleted, files cannot be recovered unless you have a separate backup, so a mistaken recursive delete can be very damaging. Be very careful to specify correct arguments to FILE_DELETE when using the RECURSIVE keyword.
The VERBOSE keyword causes FILE_DELETE to issue an informative message for every file it deletes.
Added ALLOW_NONEXISTANT and VERBOSE keywords
This page has no user notes yet. Be the first one!