TorqueScript Reference

- Main Page
- Related Pages
- Modules
- Classes

Functions
File System
Function Categories

## Functions
Boolean | createPath (pathName)
Boolean | directoryDelete (directoryName)
String | fileBase (fileName)
Boolean | fileDelete (fileName)
String | fileExt (fileName)
String | fileName (filePathName)
String | filePath (fileName)
Integer | fileSize (fileName)
String | findFirstFile (strPattern)
String | findFirstFileMultiExpr (strPattern)
String | findNextFile (strPattern)
String | findNextFileMultiExpr (string pattern)
String | getCurrentDate (bool reverse)
String | getCurrentDirectory ()
String | getDirectoryList (strPath, [intDepth]?)
String | getExecutableName ()
Integer | getFileCount (strPattern)
Integer | getFileCountMultiExpr (strPattern)
Integer | getFileCRC (filename)
String | getFileList (strPath)
String | getMainDotCsDir ()
String | getTemporaryDirectory ()
String | getTemporaryFileName ()
String | getUserDataDirectory ()
String | getUserHomeDirectory ()
Boolean | isDirectory (path)
Boolean | isFile (fileName)
Boolean | isValidImageFile (string filePath)
Boolean | isWriteableFileName (fileName)
String | makeFullPath (string path, [string currentWorkingDir]?)
String | makeRelativePath (string path, string to)
void | openFolder (path)
String | pathConcat (string path, string file1, [...fileN]*)
Boolean | pathCopy (fromFile, toFile, [nooverwrite=true]?)
void | restartInstance ()
Boolean | setCurrentDirectory (absolutePathName)

## Detailed Description

## Function Documentation

Boolean createPath | ( | pathName |  | ) |

Creates the path, verifing all the elements in a path exist or creating them if they do not. Note that the path should end with a slash (/). Otherwise, the last element in the path will be assumed to be a filename and not a path component, and it will not be created. For example "data/stage2/part1" will verify or create "data/stage2/" and not "part1".

Boolean directoryDelete | ( | directoryName |  | ) |

Parameters

  directoryName | Name of the directory to remove

Returns
  Returns true on success and false on failure

String fileBase | ( | fileName |  | ) |

Boolean fileDelete | ( | fileName |  | ) |

Parameters

  fileName | Name of the file to remove

Returns
  Returns true on success and false on failure

String fileExt | ( | fileName |  | ) |

Parameters

  Name | of file from which to extract extension

Returns
  A string containing the file's extension (assuming all data after first '.' is the extension) or returns empty string on failure

String fileName | ( | filePathName |  | ) |

Extract the filename from the full path description

String filePath | ( | fileName |  | ) |

Extract the file path from a file's full desciption

Integer fileSize | ( | fileName |  | ) |

Parameters

  fileName | The name of the file to check.

Returns
  Returns the size of the file as an integer or -1 if file not found

String findFirstFile | ( | strPattern |  | ) |

Parameters

  strPattern | The string pattern to search for.

Returns
  Returns a string representing the first file in the directory system matching the given pattern.

String findFirstFileMultiExpr | ( | strPattern |  | ) |

Parameters

  strPattern | The string pattern to search for.

Returns
  Returns the first file in the directory system matching the given pattern.

String findNextFile | ( | strPattern |  | ) |

Parameters

  strPattern | The string pattern to search for.

Returns
  Returns the next file matching a search begun in findFirstFile.

String findNextFileMultiExpr | ( | string | pattern | ) |

Returns the next file matching a search begun in findFirstFile.

String getCurrentDate | ( | bool | reverse | ) |

Gets the current date and time.

Parameters

  reverse | Determines if the format will be Month/Day/Year/Hour:Min:Seconds or Year/Month/Day/Hour:Min:Seconds

String getCurrentDirectory | ( |  | ) |

String getDirectoryList | ( | strPath | ,
|  | [intDepth] ? |
| ) |  |

Parameters

  strPath | The path in which to check
  intDepth | The depth in which to return (default 0 if not specified)

Returns
  The directory contents

String getExecutableName | ( |  | ) |

Integer getFileCount | ( | strPattern |  | ) |

Parameters

  strPattern | The string pattern to search for.

Returns
  Returns the number of files in the directory tree that match the given pattern

Integer getFileCountMultiExpr | ( | strPattern |  | ) |

Parameters

  strPattern | The string pattern to search for.

Returns
  Returns the number of files in the directory tree that match the given pattern

Integer getFileCRC | ( | filename |  | ) |

Parameters

  filename | The string representing the file from which to get the CRC

Returns
  An integer

String getFileList | ( | strPath |  | ) |

Gets all the files in the specified directory.

Parameters

  strPath | The path in which to check

Returns
  A list of files in the specified directory.

String getMainDotCsDir | ( |  | ) |

String getTemporaryDirectory | ( |  | ) |

Gets the path to the system's temporary directory

Returns
  Returns the path to the temporary directory as a string

String getTemporaryFileName | ( |  | ) |

Generates a temporary filename for use.

Returns
  Returns the formatted temporary filename for use

String getUserDataDirectory | ( |  | ) |

Returns
  Returns a string to the directory storing the user's data

String getUserHomeDirectory | ( |  | ) |

Returns
  Returns the path to the user's home directory.

Boolean isDirectory | ( | path |  | ) |

Parameters

  pathName | Path to check.

Returns
  Returns true if the given path is a folder/directory, false otherwise

Boolean isFile | ( | fileName |  | ) |

Parameters

  fileName | Filename to check.

Returns
  Returns true if the given filename is an existing file or false otherwise

Boolean isValidImageFile | ( | string | filePath | ) |

Parameters

  filePath | Full path of file to check.

Returns
  Returns true if the given filename is a valid image file or false otherwise

Boolean isWriteableFileName | ( | fileName |  | ) |

Parameters

  fileName | Filename to check.

Returns
  Returns true if the given filename is an existing file and is not Read-Only or false otherwise

String makeFullPath | ( | string | path,
|  | [string currentWorkingDir] ? |
| ) |  |

String makeRelativePath | ( | string | path,
|  | string | to
| ) |  |

void openFolder | ( | path |  | ) |

;

String pathConcat | ( | string | path,
|  | string | file1,
|  | [... fileN] * |
| ) |  |

Boolean pathCopy | ( | fromFile | ,
|  | toFile | ,
|  | [nooverwrite = true] ? |
| ) |  |

void restartInstance | ( |  | ) |

Boolean setCurrentDirectory | ( | absolutePathName |  | ) |