Created on 10 March 2006
icon_unfollowing
Login to follow
filesystem

FileSystem

Stable version 3.2.0 (Compatible with OutSystems 11)
Other versions available for 10 and Older
Uploaded on 17 Jan by 
filesystem

FileSystem

Documentation
3.2.0

FileSystem is one of the earliest OutSystems components in the Forge, and it is used in many projects to manage File system operations on Directories and Files. By default it uses the OutSystems Service user to do this operation; but with the parameters Domain, Username and Password it is also capable to impersonate another user for an operation. 

This component contains the actions mentioned below, for more information on how to use the action, take a look at the demo project.

Note: the domain-user should, of course, have the right permissions to perform the actions

Use this component with care. Since it allows direct access to the file system, you can e.g. delete essential components for your app. Also be sure that, in case you use username and password to access network shares, the impersonating user does not have overly broad rights, and the username and password are not stored as plain text in a site property or the database.


Directory actions

Note that "directory" is a different word for what Windows calls a "folder".


Directory_Create

Creates a new directory at the specified location.


Directory_Delete

Deletes the specified directory and, if indicated, any subdirectories in the directory.


Directory_Exists

Determines whether the given path refers to an existing directory on disk.


Directory_GetFileCount

Returns the number of files in a directory (subdirectories are excluded).


Directory_GetSubDirectories

Returns a list of subdirectories in a given directory.


Directory_ListDirFiles

Returns a list of files in a given directory and if desired, in its sub-directories (for each file the data returned is root path, relative path based on root path, name, extension, size, creation and modification date times).


Directory_ListFiles

Returns a list of file names in a given directory.


Directory_Move

Moves a directory and its contents to another directory. If the directory already exists at the destination location, an error is returned.

Directory_Move can also be used to rename a directory. In that case, make sure that the source and destination parent directories are the same, and the directory name part is different.


Directory_SearchFiles

Returns a list of files in a given directory and if desired, in its sub-directories based on a Search Pattern (for each file the data returned is root path, relative path based on root path, name, extension, size, creation, and modification date times).



File actions


File_AppendBinary

Appends binary content to a file.


File_AppendText

Appends text content to a file.


File_Copy

Copies a file from a specified location to another directory. If the file already exists in the destination directory, it is overwritten.


File_Delete

Deletes the specified file. An exception is not thrown if the specified file does not exist.


File_Exists

Determines whether the specified file exists.


File_GetLastWriteTime

Returns the time of the last write to a file.


File_GetSize

Returns the size of a file in bytes.


File_Move

Moves a file from a specified location to another directory. If the file already exists at the destination location, an error is returned.

File_Move can also be used to rename a file. In that case, make sure that the source and destination directories are the same, and the file name part is different.


File_ReadBinary

Reads the binary content of a file. The path must include the file name (e.g.: c:\temp\test.txt).


File_ReadText

Reads the content of a text file using the system's default ANSI encoding.


File_ReadTextLines

Reads a text file and returns a record list with a string for each line in the file.


File_WriteBinary

Write binary content to a file.


File_WriteText

Writes Text content to a file.


File_WriteTextLines

Write the Text lines to a file. The text content is structured as a record list of text lines.



Low-level File actions


FS_Close

Closes a file previously opened with FS_Open.


FS_Open

Opens a file for low-level reading.


FS_ReadBytes

Reads the specified number of bytes from a file opened with FS_Open.


FS_Seek

Moves the file read pointer to a specific position in the file opened with FS_Open.



Path actions

These actions don't use have a domain, user, and password parameter, because they're just string operations.


Path_ChangeExtension

Changes the extension of a path string, and returns the modified path (does _not_ change anything on the file system).


Path_GetApplicationDirectory

Returns the physical file path that corresponds to the ASP.NET application's virtual directory on the server.


Path_GetDirectoryName

Returns the directory information for the specified path string.


Path_GetDirectorySeparatorCharacter

Returns the platform-specific character used to separate directory levels in a path string.


Path_GetExtension

Returns the extension of a path string.


Path_GetFileName

Returns the file name and extension of the specified path string.


Path_GetFileNameWithoutExtension

Returns the file name of the specified path string without the extension.


Path_GetTemporaryFileName

Returns a unique temporary file name and creates a zero-byte file by that name on disk.


Support options
This asset is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from  who created this asset.
Dependencies
FileSystem has no dependencies.