You create an ActiveX File object by calling ActiveXObject() with a single argument, Scripting.FileSystemObject:
myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
You create a File object by using the ActiveX's GetFile() method:
myFile = myActiveXObject.GetFile("c:\\Autoexec.bat");
Here are the File object's properties:
| Property | Description |
Attributes | Refers to the file attributes |
DateCreated | Returns the file's creation date |
DateLastAccessed | Returns the file's last-accessed date |
DateLastModified | Returns the file's last-modified date |
Drive | Returns the file's letter drive |
Name | Returns the file name |
ParentFolder | Returns the file's parent folder name |
Path | Returns the file's long path |
ShortName | Returns the file's short name |
ShortPath | Returns the file's short path |
Size | Returns the file size |
Type | Returns the file type |
Here are the File object's methods:
| Method | Description |
Copy() | Copies the file from one folder to another |
Delete() | Removes the file |
Move() | Moves the file from one folder to another |
OpenAsTextStream() | Opens the file as a text stream |
People who read this tip also read these tips:
Look for similar tips by subject:
|