FILESRV -- File Services 1) Usage | OBJECT file[FILESRV]; The FILESRV class contains methods for copying, appending, moving, and deleting files. Most parameters to FILESRV methods are file names. The format of file names varies between operating systems. 2) Methods 2.1 APPEND | FILE.APPEND(source, dest) ! Str,Str => 0|error The APPEND method copies the content of the 'source' to the end of the 'dest' file. 'Source' and 'dest' must be distinct files. If they are the same file, undefined behaviour and loss of data may occur. The content of 'source' is written to 'dest' in such a way that reading 'dest' subsequently will first retrieve the content of 'source' and then the content of 'dest'. If the file named in 'dest' does not exist, FILE.APPEND will fail. FILE.APPEND returns zero upon successful completion. In case of an error, FILE.APPEND returns a negative error code. The meanings of error codes may be loked up in a later section. 2.2 COPY | FILE.COPY(source, dest) ! Str,Str => 0|error The COPY method copies the content of the 'source' file to the 'dest' file. 'Source' and 'dest' must be distinct files. If they are the same file, undefined behaviour and loss of data may occur. If the file named in 'dest' already exists, FILE.COPY will overwrite it silently. FILE.COPY returns zero upon successful completion. In this case, the contents of 'source' and 'dest' can safely be assumed equal. In case of an error, FILE.COPY returns a negative error code. If an error occurs, the destination file will be deleted. The meanings of error codes may be loked up in a later section. 2.3 DELETE | FILE.DELETE(filename) ! Str => 0|error The DELETE method removes the file 'filename'. On systems supporting multiple aliases (links) per file, only the specified alias will be deleted. When deleting the only alias of a file, the physical file will become inaccessible. On systems not providing multiple aliases, FILE.DELETE removes the file specified immediately. FILE.DELETE returns zero upon success and a negative error code in case of an error. 2.4 EXISTS | FILE.EXISTS(filename) ! Str => 0|-1 The EXISTS message returns truth (-1) if the given 'filename' exists. Otherwise, it returns falsity (0). 2.5 MOVE | FILE.MOVE(source, dest) ! Str,Str => 0|error The MOVE message attempts to change the name of the 'source' file to 'dest'. If 'dest' already exists, it will be removed by this operation. If, for whatever reason, 'source' cannot be renamed to 'dest', FILE.MOVE attempts to copy the file using | FILE.COPY(source, dest) If the file cannot be copied, either, FILE.MOVE returns an error code, leaves 'source' untouched, and removes 'dest'. If the file could be copied successfully, 'source' is deleted. For an overview of error code, see a subsequent section. 2.6 Error Codes E_OPEN A file could not be opened for reading . or appending. E_CREATE A destination file could not be created. E_READ A read error occurred (most commonly . caused by a media error). E_WRITE A wriet error occured (most commonly . caused by insufficient space on the target . device). E_DELETE A file could not be deleted.