File System Driver

Modified on 2010/12/15 10:26 by Administrator — Categorized as: Driver

The file system driver allows manipulation of the file on any machine running the driver.

Accessing files and directories is done under the context of the user that the driver service is running under. By default this is the windows SYSTEM user account. This can cause some file permissions/access rights issues if the file does not allow access to that user. See the Driver Service documentation for more information.

Manufacturer: N/A


Configuration Settings

Events

Ready State Changed

The device's running and ready state changed.

Whenever Filter:

none

EventArgs:


Instance Properties

DeviceDisplayName

The display name for this device.

Accessibility : Read Only

Type: String

DeviceStartTime

The date and time when this device was started.

Accessibility : Read Only

Type: DateTime

DeviceLifecycleStage

The current lifecycle stage of the device. The stages in order are: Pending Start, Starting, Running, Stopping

Accessibility : Read Only

Type: Number

DeviceIsRunningAndReady

Indicates if the device is ready for use, ie it is in the Running lifecycle stage and all properties are valid and all methods are ready to be used.

Accessibility : Read Only

Type: Boolean

Instance Methods

CopyFile ( String, String )

Copies an existing file to a new file. Overwriting a file of the same name is allowed.

Syntax

void CopyFile( String sourceFilePath, String destFilePath )

Parameters

sourceFilePath : Error: The method 'CopyFile' is missing a ScriptObjectMethodParameterAttribute for 'sourceFilePath'.
destFilePath : Error: The method 'CopyFile' is missing a ScriptObjectMethodParameterAttribute for 'destFilePath'.

CopyFile ( String, String, Boolean )

Copies an existing file to a new file. Overwriting a file of the same name is allowed.

Syntax

void CopyFile( String sourceFilePath, String destFilePath, Boolean overwrite )

Parameters

sourceFilePath : Error: The method 'CopyFile' is missing a ScriptObjectMethodParameterAttribute for 'sourceFilePath'.
destFilePath : Error: The method 'CopyFile' is missing a ScriptObjectMethodParameterAttribute for 'destFilePath'.
overwrite : true if the destination file can be overwritten; otherwise, false.

MoveFile ( String, String )

Moves a specified file to a new location, providing the option to specify a new file name.

Syntax

void MoveFile( String sourceFilePath, String destFilePath )

Parameters

sourceFilePath : The path of the file to move.
destFilePath : The new path for the file.

FileExists ( String )

Determines whether the specified file exists.

Syntax

Boolean FileExists( String filePath )

Parameters

filePath : The file to check.

DeleteFile ( String )

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

Syntax

void DeleteFile( String path )

Parameters

path : The path of the file to be deleted.

CreateDirectory ( String )

Creates all directories and subdirectories as specified by path.

Syntax

void CreateDirectory( String path )

Parameters

path : The directory path to create.

MoveDirectory ( String, String )

Moves a file or a directory and its contents to a new location.

Syntax

void MoveDirectory( String sourceDirPath, String destDirPath )

Parameters

sourceDirPath : The path of the file or directory to move.
destDirPath : The path to the new location for sourceDirName.

DirectoryExists ( String )

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

Syntax

Boolean DirectoryExists( String directoryPath )

Parameters

directoryPath : The directory path to check.

DeleteDirectory ( String )

Deletes an empty directory from a specified path.

Syntax

void DeleteDirectory( String path )

Parameters

path : The name of the empty directory to remove. This directory must be writable or empty.

DeleteDirectory ( String, Boolean )

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

Syntax

void DeleteDirectory( String path, Boolean recursive )

Parameters

path : The name of the empty directory to remove. This directory must be writable or empty.
recursive : true to remove directories, subdirectories, and files in path; otherwise, false.

WriteFile ( String, String )

Creates a new file and writes the specified text to the file. If the target file already exists, it is overwritten.

Syntax

void WriteFile( String path, String contents )

Parameters

path : The file to write the specified text to.
contents : The text to write to the file.

WriteFile ( String, ByteArray )

Creates a new file, writes the specified byte array to the file. If the target file already exists, it is overwritten.

Syntax

void WriteFile( String path, unknown contents )

Parameters

path : The file to write the specified string to.
contents : The string to write to the file.

AppendFile ( String, String )

Appends the specified text to a file, creating the file if it does not already exist.

Syntax

void AppendFile( String path, String contents )

Parameters

path : The file to append the specified string to.
contents : The text to append to the file.

ReadTextFile ( String )

Reads all the text from a file.

Syntax

String ReadTextFile( String path )

Parameters

path : The file to read.

ReadBinaryFile ( String )

Reads all the bytes from a file.

Syntax

unknown ReadBinaryFile( String path )

Parameters

path : The file to read.

SetPropertyForDuration ( String, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.

SetPropertyForDuration ( String, Number, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, Number arrayIndex, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
arrayIndex : The property's array index to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.