|
The following standard DWS file functions are supported in DWS scripts since version 1.9.0.5:
procedure SaveStringToFile(<string filename>, <string string>);
- writes specified string to specified file, overwriting any existing contents
function LoadStringFromFile(<string filename>): String;
- returns contents of specified file as a string
procedure AppendStringToFile(<string filename>, <string string>);
- writes specified string to end of specified file, retaining any existing contents
function FileExists(<string filename>): Boolean;
- returns True if file specified by <filename> exits, else False
function DeleteFile(<string filename>): Boolean;
- deletes file specified by <filename> and returns True, else returns False
function RenameFile(<string oldFilename>, <string newFilename>): Boolean;
- renames file specified by <oldFilename> to <newFilename> and returns True, else returns False
procedure ChDir(<string path>);
- changes current directory to <path>
- only affects this process
- if <path> includes a drive letter, the current drive is also changed
function CreateDir(<string path>): Boolean;
- creates directory specified by <path> and returns True, else returns False
function RemoveDir(<string path>): Boolean;
- removes directory specified by <path> and returns True, else returns False
- the directory must be empty or RemoveDir will fail
function GetCurrentDir: String;
- returns fully qualified path of current directory
function SetCurrentDir(<string path>): Boolean;
- changes current directory to specified path and returns True, else returns False
function FileSearch(<string name>, <string dirList>): String;
- looks for <name> in directories named in <dirList> and returns fully qualified pathname to it, or an empty string
- separate directories in <dirList> with semicolons
function ExtractFileDrive(<string path>): String;
- returns the drive portion of <path>
- if <path> does not contain a drive specification, an empty string is returned
function ExtractFileDir(<string path>): String;
- returns the folder portion of <path>
- if <path> contains no drive or directory parts, an empty string is returned
function ExtractFileName(<string path>): String;
- returns file name portion of <path>
- if <path> contains no drive or directory parts, returns <path>
function ExtractFilePath(<string path>): String;
- returns the drive and directory portions of <path>
- if <path> contains no drive or directory parts, an empty string is returned
function ExtractFileExt(<string path>): String;
- returns the rightmost period and all following characters from <path>
- if <path> contains no extension, an empty string is returned
- note that ExtractFileExt('foobar.sql.txt') returns '.txt', not '.sql.txt'
function ChangeFileExt(<string filename>, <string extension>): String;
- returns <filename> with <extension> instead of the existing extension
- does not rename the file
|