remove() - Removing a file from disk storage¶
remove() |
Remove a file from disk storage |
SYNTAX
remove(filename)
Delete the named file from disk storage. The filename may be a full
pathname or simply the name of the file. The filename can also contain a server:
prefix to delete the file in the server machine (if the
Server security database permits it).
It must be a string constant or a text expression.
The function returns zero if the file is successfully deleted, and returns an error code otherwise. The values that may be returned, which are defined in $SCULPTOR/include/errors.h, are:
0 |
No error occurred. The file was removed. |
|
NOFILE |
1 |
The file could not be found. |
NOPERMS |
2 |
No write permission for the specified path or file. |
NOTES
The function provides a method for deleting files which is portable between operating systems.
The function removes a single file only. Wildcard expansion, such as remove(*.bak) is not permitted. To remove more than one file at a time, use the exec command to execute the ‘delete file’ command on your operating system.
EXAMPLE
!temp ErrStat,,u1
tmp.ErrStat = remove("myserver:/tmp/data/junk.dat")
switch (tmp.ErrStat) {
case = OKAY:
info "File removed"
break
default:
info "Unable to remove file - error " + tostr(tmp.ErrStat)
break
}
RELATED TOPICS |