COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button
ADVANCE VB SCRIPT FOLDER
Folder
Folder is an Object, which contains both properties and methods
that allow the developers to create, delete or move a folder.
Methods
• Copy
• Delete
• Move
• CreateTextFile
Properties
• Attributes
• DateCreated
• DateLastAccessed
• DateLastModified
• Drive
• Files
• IsRootFolder
• Name
• ParentFolder
• Path
• ShortName
• ShortPath
• Size
• SubFolders
• Type
Example
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
' Enter a Folder Name that exists on your System'
Set f = fso.GetFolder("D:\PROJECT\")
ShowFileInfo = "Created: " & f.DateCreated & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "attributes " & f.attributes & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "Last Accessed : " & f.DateLastAccessed & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "DateLastModified : " & f.DateLastModified & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "Drive : " & f.Drive & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "count : " & f.Files.count & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "IsRoot folder : " &f.IsRootFolder & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "Name : " & f.Name & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "parent folder : " & f.ParentFolder & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "Path : " & f.Path & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "shortname : " & f.ShortName & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "ShortPath : " & f.ShortPath & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "File Size : " & f.Size & "<br / >"
document.write ShowFileInfo
ShowFileInfo = "Type : " & f.Type & "<br / >"
document.write ShowFileInfo
</script>
</body>
</html>
If the above script is saved as HTML and executed in IE,
we would get the following output in the console.
Created: 22/02/2012 8:24:57 PM
attributes 16
Last Accessed : 1/08/2013 12:48:36 PM
DateLastModified : 1/08/2013 12:48:36 PM
Drive : D:
count : 6
IsRoot folder : False
Name : PROJECT
parent folder : D:\
Path : D:\PROJECT
shortname : PROJECT
ShortPath : D:\PROJECT
File Size : 8655239975
Type : File folder