Script Command: FILE
FILE {sub-command} {filename} [args] ...
This command is useful for interfacing to a file. It supports a variety of different sub-commands that will perform some action on the specified file.
Current sub-commands supported:
append-
Syntax: FILE append <}> of text<}>
Append the line of text to the end of the specified file. Note that if the line contains any whitespace, then it must be enclosed within double-quotes. If the file exists the line is appended to the existing file; else the file is created.
basename-
Syntax: FILE basename
Populate the shell variable FILE with the string within <}>immediately following the last slash or backslash. If no slash or backslash is present in the <}>then FILE will be populated with the full filename.
copyscreen-
Syntax: FILE copyscreen
Transfers the current screen buffer to the specified file.
delete-
Syntax: FILE delete
Delete the specified file.
edit-
Syntax: FILE edit
Open the specified file using the configured editor.
first-
Syntax: FILE first <{>dirname\expression
This command will use the FindFirstFile() function to retrieve the first file in the directory specified whose name matches the expression specified. For example: find first C:\windows\media\*.wav will return the first .wav file found in C:\windows\media. The resulting filename is placed in the $FILE shell variable. If no file is found, the FILE shell variable is removed.
fstat-
Syntax: FILE fstat
Populate the FILE shell variable with "FILE" if filename is a file, "DIR" if filename is a directory, and "NULL" if it doesn't exist.
lntot-
Syntax: FILE lntot <{>filename
Populate the FILE shell variable with the number of lines contained in the assumed-to-be text file.
mktemp-
Syntax: FILE mktemp <{>path/prefix
Populate the FILE shell variable with a new filename created based on the specified path/prefix.
next-
Syntax: FILE next
After running "file first" to retrieve the first file of the directory, this command is used to retrieve all subsequent files matching the same specification. The resulting filename is placed in the $FILE shell variable. If no file is found, the FILE shell variable is removed.
size-
Syntax: FILE size
Populate the FILE shell variable with the size of the file if present, else "NULL".
strstr-
Syntax: FILE strstr <}> <}>[occurrance]
Two shell variables are loaded with this command (FILE & LINE)...
If the string is found in the file, then populate FILE with "YES" and LINE with the linenumber it was found on.
If the string was not found in the file, then populate FILE with "NO" and clear the LINE shell variable.
If the second (optional) argument 'occurrance' is specified, then search for the 'Nth' occurrance of the string instead of the first.
token-
Syntax: FILE token <}><}>
Populate the FILE shell variable with the specified token on the specified line of the file. A token is considered to be any whitespace delimited character string. The FILE shell variable may be populated with an error message if necessary...
_INTERNAL_ERROR_ indicates some internal failure (shouldn't happen).
_END_OF_FILE_ indicates that the line request was beyond the end of the file.
_END_OF_LINE_ indicates that the token request was beyond the end of the line.