filedelete

Delete the specified file.

filedelete  FilePath

Example: filedelete "sub1dir\test.txt"

Parameters

Parameters
Parameter Data Type Description
FilePath String File name, optionally preceded by the path to the file. The file can be located in a ZIP archive. Must not end with a directory separator.

Return Values

Values returned by $procerror
Value  Error constant Meaning
0

 

Successful
-13 <UIOSERR_OS_COMMAND> An error occurred while trying to perform the OS command. Set /pri=64 to display the exact error in the message frame.

Use

Allowed in all component types.

Description

The filedelete statement deletes the specified file, using any file redirections in the assignment file.

Specifying Parameters

  • Each specification can be a string, a field (or indirect reference to a field), a variable, or a function that evaluates to a string.
  • The total length of any path (or file name or directory name) must not exceed 255 bytes.
  • Valid generic directory separators are the backward slash (\), the forward slash (/) , and the period (.) in combination with square brackets ([a.b]). These are translated to the platform-specific separators.
  • No wildcards are allowed in any path, except for $ldirlist and $dirlist, which allows the Uniface wildcards ? (GOLD ?) and * (GOLD *) in the directory name, for example ab?, or in its suffix, for example abc\*.txt.

For more information, see Syntax of File and Directory Names.

Operation failure

The operation fails if FilePath:

  • Is not a file
  • Does not exist
  • Is in use (locked)
  • Does not permit user-deletion due to insufficient authorization level
  • Has invalid syntax

The following example deletes the file test.txt in the directory sub1dir in the current directory:

filedelete "sub1dir\test.txt"
History
VersionChange
9.1.01Added ZIP file support

Related Topics