AMT Help Files

FileInfo Interface

The FileInfo object (IFileInfo) is returned by the GetFileInfo function of the ComScript FileObject. Through this object, information about the file specified in the GetFileInfo function is available in the properties described below.

The property values are the values of the moment the GetFileInfo function call. When it is important to see if values have changed, a new call the GetFileInfo function has to be made first.
The file information cannot be changed through these properties, all properties are read-only.

Properties

Name Type Description
Attributes System IO FileAttributes The file attributes of the file as System.IO.FileAttributes enum value.
CreationTime String The local date/time the file was created in the format YYYYMMDDhhmmssnnn where nnn stands for milliseconds.
CreationTimeUtc String The UTC date/time the file was created in the format YYYYMMDDhhmmssnnn where nnn stands for milliseconds.
Directory Boolean Always False, since the GetFileInfo function does not yet work on folders.
Exists Boolean True when the file specified in the GetFileInfo function call exists and false when not.
FileId String The internal File Id (GUID) of the file.
FileSize Integer64 The size of the file.
FullName String The full name of the file including the drive and path to the file.
InUse Boolean True when the file is in use by the File Controller or any other process, otherwise False.
LastAccessTime String The local date/time the file was last accessed in the format YYYYMMDDhhmmssnnn where nnn stands for milliseconds.
LastAccessTimeUtc String The UTC date/time the file was last accessed in the format YYYYMMDDhhmmssnnn where nnn stands for milliseconds.
LastWriteTime String The local date/time the file was last written to (modified) in the format YYYYMMDDhhmmssnnn where nnn stands for milliseconds.
LastWriteTimeUtc String The UTC date/time the file was last written to (modified) in the format YYYYMMDDhhmmssnnn where nnn stands for milliseconds.
Name String The name of the file without the drive and path.
ReadOnly Boolean True when the file has the ReadOnly attribute set in the file system.
RecordSize Integer The size of the record.
ShareModeLevel Integer The highest used ShareModeLevel for the file.

Share Mode Levels

Mode Name Description
1 Exclusive The file is opened exclusively. No other process can access the file.
2 Exclusive Batch The file is opened exclusively for this batch. Only processes started by the same batch can access the file.
3 Shared Read/Write Other processes can read from and write to the file.
4 Shared Read Other processes can read the file.

Example

PowerShell

# See ComScript Connection Interface
# ...

$ComScr.Connect()

#Create an object of the FileObject Interface to be able to handle files.
$AmtFile = $ComScr.CreateFileObject()

#Create an object of the FileInfo Interface to see information of that file.
$AmtFileInfo = $AmtFile.GetFileInfo("D:\Files\Orders.dat", 5)

if ($AmtFileInfo.Exists) {
  $FileChanged = $AmtFileInfo.LastWriteTimeUtc
  $FileSize = $AmtFileInfo.FileSize
} Else {
  $Msg.AddMsgInformation("Orders file was not found.")
}

# Finally release the variables and clean up the session.
$ComScr.Dispose()

Contents