The File object is obtained using FileSystemObject. It is used to manipulate or obtain information about a file. To use a File object simply:
Create an instance of the FSO object:
Set objetFSO = CreateObject("Scripting.FileSystemObjet)
Open a file by creating a File object, for example:
Set Fichier = objetFSO.GetFile("c:\myfile")
Use a method or property of the File object, for example:
Here is a summary of collections, properties and methods of the File object:
The Attributes property
The Attributes property allows you to set or retrieve the attributes of a particular file or folder. The returned value, defining the attributes of the file is calculated by summing the values ??of the attributes of the file:
Normal. File without attribute
ReadOnly. Read-only file that can be read only (not editable).
Hidden. Hidden file
System. System file, necessary for the proper functioning of the system
Volume. Volume label of a disk drive.
Directory. Folder (Directory)
Archive. File modified since the previous backup.
Alias. This is a shortcut.
Compressed. It is a compressed file
For an archive, hidden, read-only, the return value will be:
32+2+1 = 35
DateCreated property allows you to set or retrieve the date and time of creation of a particular file or folder.
DateLastAccessed property allows you to set or retrieve the date and time of last access of a particular file or folder.
DateLastModified property to set or retrieve the date and time at which the last modification was made to a file or folder
Drive property contains the name of the drive on which the target file or folder is located.
The Name property allows you to set or retrieve the name of the file or folder in question, without indicating the path.
The ParentFolder property contains the name of the parent folder of the specified file or folder.
The Path property contains the absolute path of the specified file or folder.
The ShortName property contains the name of the specified file or folder in its abbreviated form.
The ShortPath property contains the path to the file or folder specified in its abbreviated form.
The Size property contains the size of the specified file, in bytes.
The Type property containsinformation about the type of the specified file or folder.
Copy method contains information about the type of file or folder specified.