/
File Manipulation Functions

File Manipulation Functions



This section contains functions that enable users to handle directories and files.

 

Starting with SIL Engine 5.8.0.0 we limit the directories you have access to. By default you will have unrestricted access to the following directories:

  • sil.home (usually set on silprograms)

  • kepler.home (usually set on kepler)

  • <JIRA_HOME>/tmp

  • <JIRA_HOME>/log

  • <JIRA_HOME>/export

  • <JIRA_HOME>/import

  • <JIRA_HOME>/data

  • The directory announced by java.io.tmpdirvariable

  • The user home directory, if the user under which Jira runs has a home directory

Extra directories may be specified defining sil.allowed.dirs property. The Java process must be launched with -Dsil.allowed.dirs=<path1>:<path2> ('nix systems) or -Dsil.allowed.dirs=<path1>;<path2> (Windows). Attempting to access files outside designated directories will result in error.

Functions summary

  • readFromCSVFileReads the values from the CSV file, returning them to an array, of N rows * M columns values.
  • createDirectoryReturns "true" if the directory was created successfully and "false" otherwise.
  • createFileCreates an empty file.
  • deleteFileDeletes a file. It also returns "true" if the file was deleted successfully and "false" otherwise.
  • directoryExistsReturns "true" if the directory exists and "false" otherwise.
  • fileCloseCloses a previously opened file and removes it from memory.
  • fileContainsReturns "true" if the file contains any string that matches the specified regex.
  • fileCopyCopy a file from one location to another.
  • fileExistsReturns 'true' if the file exists and 'false' otherwise.
  • fileInfoReturns basic file information about a file such as the date it was created.
  • fileMoveMoves a file from one location to another.
  • fileOpenOpens a file in memory so that it may be read from.
  • fileReadReads a byte array from a file until it reaches the specified length or until the EOF is reached.
  • fileReadByteReads a byte from an open file.
  • fileReadLineReads a line of text from an open file until it reaches the end of the line (\n or \r\n). Stops also on EOF (end of file).
  • fileSeekMoves the file pointer to a specific spot in an already open file. If the position is negative, moves the file pointer at the end of the file. If the position is 0 (zero) it moves the pointer at the beginning of the file.
  • fileSHA256ChecksumReturns the SHA256 checksum of the file.
  • fileSizeReturns the size for a given file.
  • fileTruncateClears the content of the specified file. Creates a new file if the one you want to clear content for doesn’t exist.
  • fileWriteWrites text or byte data to an open file.
  • findDirectoriesSearches for directories that match the given regex in the specified folder.
  • findFilesSearches for files that match the given regex in the specified folder.
  • printInFilePrints the provided value in the specified file.
  • readFromBinaryFileRead the text of a binary file.
  • readFromTextFileRead the text of the file.
  • renameFileRenames a file.
  • writeToBinaryFilePrints bytes to a specified file. The file can be overwritten or appended to.
  • zipFilesAdds a file or an array of files to a zip file.
  • deleteDirectoryDeletes a dir. It also returns "true" if the directory was deleted successfully and "false" otherwise.

 

Related content

Need support? Create a request with our support team.

Copyright © 2005 - 2025 Appfire | All rights reserved.

OSZAR »