The File Object | |
The File object provides access to the files within each folder. |
Attributes | |
Property | |
Returns the attributes of the file. Can be a combination of any of the values: Normal (0), ReadOnly (1), Hidden (2), System (4), Volume (name) (8), Directory (folder) (16), Archive (32), Alias (64) and Compressed (128). |
DateCreated | |
Property | |
Returns the date and time that the file was created. |
DateLastAccessed | |
Property | |
Returns the date and time that the file was last accessed. |
DateLastModified | |
Property | |
Returns the date and time that the file was last modified. |
Drive | |
Property | |
Returns the drive letter of the drive on which the file resides. |
Name | |
Property | |
Sets or returns the name of the file. |
ParentFolder | |
Property | |
Returns the Folder object for the parent folder of this file. |
Path | |
Property | |
Returns the absolute path of the file using long file names where appropriate. |
ShortName | |
Property | |
Returns the DOS-style 8.3 version of the file name. |
ShortPath | |
Property | |
Returns the DOS-style 8.3 version of the absolute path of this file. |
Size | |
Property | |
Returns the size of the file in bytes |
Type | |
Property | |
Returns a string that is a description of the file type (such as "Text Document" for a .txt file) if available. |
Copy(destination,overwrite) | |
Method | |
Copies this file to the folder specified in destination. If destination ends with a path separator character ('\') then destination is assumed to be a folder into which the copied file will be placed, otherwise it is assumed to be a full path and name for a new file to be created. An error will occur if the destination file already exists and the optional overwrite parameter is set to False. The default for overwrite is True. |
CreateTextFile(filename,overwrite,unicode) | |
Method | |
Creates a new text file on disk with the specified filename and returns a TextStream object that refers to it. If the optional overwrite parameter is set to True, any existing file with the same path and name will be overwritten. The default for overwrite is False. If the optional unicode parameter is set to True, the content of the file will be stored as Unicoded text. The default for unicode is False. |
Delete(force) | |
Method | |
Deletes this file. If the optional force parameter is set to True the file will be deleted even if the Read-only attribute is set. The default for force is False. |
Move(destination) | |
Method | |
Moves this file to the folder specified in destination. If destination ends with a path separator character ('\') then destination is assumed to be the folder in which to place the moved file, otherwise it is assumed to be a full path and name for a new file. An error will occur if the destination file already exists. |
OpenAsTextStream(iomode,format) | |
Method | |
Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file. The iomode parameter specifies the type of access required. The permissible values are ForReading (1 - the default), ForWriting (2), and ForAppending (8). The format parameter specifies the format of the data to be read from or written to the file. Permissible values are TristateFalse (0, the default) to open it as ASCII, TristateTrue (-1) to open it as Unicode, and TristateUseDefault (-2) to open it using the system default format. |