Navigation: Language Reference > 13 - Built-in Functions >====== REMOVE (delete files/folders) ====== | |
REMOVE(file)
REMOVE(<;name>,<;options>)
REMOVE | Deletes a FILE. |
file | The label of the FILE to be removed, or a string constant or variable containing the filename of the file to erase. |
There are two variants of the REMOVE function.
REMOVE(file) deletes a physical file. The file must be closed, or the “File Already Open” error is posted. If any error is posted, the file is not removed.
Since some file drivers use multiple physical disk files for one logical FILE structure, the default filename and extension assumptions are dependent on the file driver. If any error is posted, the file is not deleted.
REMOVE(<;name> [,<;options>])
REMOVE | |
name | <;name> is a constant string, string variable or expression naming file(s) to be erased. Wildcards are allowed in specifying the file(s), but wildcards in the Path specification are not supported |
options | <;options> is a set of flags to control how to erase files/directories. If the <;options> parameter is omitted, the default value REMOVE:FILESONLY is used. |
The following EQUATEs are defined in EQUATES.CLW:
REMOVE:FILESONLY EQUATE(01h)
REMOVE:RECURSIVE EQUATE(02h)
REMOVE:PROGRESS EQUATE(04h)
REMOVE:CONFIRM EQUATE(08h)
REMOVE:FILESONLY - if set in <;options>, only files are erased, directories are not removed
REMOVE:RECURSIVE - if set in <;options>, files in nested sub-directories are recursively removed
REMOVE:PROGRESS - if set in <;options>, the progress dialog is displayed
REMOVE:CONFIRM - if set in <;options>, a dialog asking confirmation to remove files/directories is displayed
If the <;options> parameter is omitted, the default value REMOVE:FILESONLY is used.
Errors Posted:
02 | File Not Found |
03 | The system cannot find the path specified. |
05 | Access Denied |
52 | File Already Open |
Example:
REMOVE('Changes.dat') !Delete the changes file
REMOVE('*.bak', REMOVE:RECURSIVE)
See Also: