Javascript FSO GetFolder Method
Javascript FileSystemObject (FSO) GetFolder method provides the functionality to access the properties and methods associated with folder object. FSO GetFolder method returns the Folder object that further provides the access to all such properties and methods. GetFolder method allows you to access the properties such as Name, Date last accessed, date last modified, path, parent folder etc. Methods supported by GetFolder method are copy, move, delete, create text file and retrieve its text stream to write text into it, is root folder etc. GetFolder method targets the specified folder and performs each action on it based on the applied method.
Syntax for Javascript FSO GetFolder Method
fso.GetFolder( folderPath );
As shown in the above syntax of FSO GetFolder method it accepts only 1 parameter as folderPath. GetFolder method returns the folder object along with its properties and methods that targets on the folder name specified at the end of folderPath string value.
Example of FSO GetFolder Method
<script type="text/javascript">
// initialize ActiveXObject and create an object of Scripting.FileSystemObject.
var fso = new ActiveXObject("Scripting.FileSystemObject");
// returns the folder object associated with the specified folder
var folderObj = fso.GetFolder("C:\\Temp\\myFolder");
document.write(folderObj.Name);
fso = null;
// Output:
// myFolder
</script>
FSO Folder Object Properties
- Attributes: gets or sets the attributes of the folder.
- DateCreated: returns the date and time when the folder was created.
- DateLastAccessed: returns the date and time when the folder was last accessed.
- DateLastModified: returns the date and time when the folder was last modified.
- Drive: returns the drive letter retrieved from the path of the folder.
- IsRootFolder: returns the Boolean value i.e. true or false that indicates whether the folder is root folder or not.
- Name: returns the name of the folder.
- ParentFolder: returns the name of the parent folder.
- Path: returns the complete path of the folder.
- ShortName: returns the short name of the folder according to 8.3 naming convention of file system.
- ShortPath: returns the short path of the folder according to 8.3 naming convention of file system.
- Size: returns the size of the folder in bytes.
- Type: returns the type of the folder.
FSO Folder Object Collections
- Files: returns the collection of files stored in the folder.
- SubFolders: returns the collection of subfolders stored inside the folder.
FSO Folder Object Methods
- Copy: copies the folder to the specified location.
- Delete: deletes the folder.
- Move: moves the folder to the specified location.
- CreateTextFile: creates a text file inside the folder and returns the textstream
Continue to next tutorial: Javascript FSO GetParentFolderName Method to learn how to get the name of the parent folder.

* will not be published
* hint: http://www.example.com