AMT Help Files

FileInfo Interface

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

Note: 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.

Note II: The file information cannot be changed through these properties, all properties are ReadOnly.

Properties


Name
Return 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. Note: This is NOT the FileId used in Reports/Forms.
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 exclusive, no other process can access the file.
2 Exclusive Batch The file is opened exclusive for this batch. I.e. the file is shared with processes started by the same batch.
3 Shared Read/Write The opened file can be accessed both for read and write by other processes.
4 Shared Read The opened file can be accessed for read by other processes.



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()