Scripting the File System, Part I: The File Object - Doc JavaScript
Scripting the File System, Part I
The file Object
GetFile(pathName) | Object |
This method returns the file
object of the given file name. The following script should create a file
object for f:\yehuda\js\tips\myapps.txt
:
<SCRIPT LANGUAGE="JavaScript">
<!--
var fso = new ActiveXObject("Scripting.FileSystemObject");
fileObj = fso.GetFile("f:\\yehuda\\js\\tips\\myapp.txt");
-->
</SCRIPT>
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 |
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 |
Next: How to use GetFolder()
Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: November 20, 2000
Revised: November 20, 2000
URL: https://www.webreference.com/js/column71/8.html