Programmer Guide/Macro Library/Kernal/StdLib/FileToolBox
From STX Wiki
< Programmer Guide | Macro Library | Kernal | StdLib
Jump to navigationJump to search
A toolbox of useful file functions which take paths as parameters, shielding the user from the file objects themselves.
Contents
ATTRIBUTE
Get a file's attributes.
- usage
- FILETOOLBOX ATTRIBUTE filename attribute
- return
- the requested attribute
- -1 if the macro failed
- -2 if the attribute doesn't exist
- note
- all attributes supported by file items are supported by this command. just don't use the exclamation mark !
COMPARE
Simple files comparison.
- usage
- FILETOOLBOX COMPARE file1 file2
- return
- 1 if they are different:0 if they are the same:-1 if the macro fails
- notes
- only the size in bytes is compared at the moment
COPY
Copy a file on disk.
- usage
- FILETOOLBOX COPY sourcefile targetfile
- return
- 0 if file was copied:-1 if file was not copied
DELETE
Delete a file from disk.
- usage
- FILETOOLBOX DELETE filename
- return
- 0 if file was deleted:-1 if file was not deleted
EXISTS
Test for a file's existence on disk.
- usage
- FileToolBox EXISTS filename
- return
- 0 if file FileName exists
- 1 if file FileName does not exist
- 2 if FileName is a directory
RENAME
Rename a file on disk.
- usage
- FileToolBox RENAME Source Destination
- return
- 0 if file was renamed:-1 if file was not renamed
TOKENIZE
Tokenize the file path into drive, directory, name and extension. Note that this only works if the directory path exists!
- usage
- FileToolBox TOKENIZE filename [ keyword{drive|directory|name|extension} ]
- return
- Empty string on failure or 'drive ; directory ; name ; extension' or the part of the filename specified by keyword
- example
FileToolBox Tokenize $#file readstr '$result' #drive';'#dir';'#name';'#ext