VB Scripting File system Object

File System Object

To work with file system object you should have the knowledge of vb scripting. just basic knowledge is enough to handle the tasks over here

File system object is a scripting runtime object. By creating object for file system object we use methods and properties of file system object to perform tasks

File system object is very intresting concept that we can automate entire processes that done manually i.e

creating folders,copying folders,Deleting folders,moving folders,creating text files,writing text file,copying text from one text file to other text file creating any format files creating time stamp

To Create Folder

set fso=createobject("scripting.filesystemobject")
fso.createfolder "D:\madhu"


To Move Folder one path to other Path

fso.movefolder "D:\madhu","D:\Sree Harsha\"

To copy Folder to other path

fso.copyfolder "D:\madhu","D:\Sree Harsha\"

To create text file

set fso=createobject("scripting.filesystemobject")
fso.createtextfile ("D:/madhu.txt")


to get the file

set fso=createobject("scripting.filesystemobject")
fso.createtextfile "D:/madhu.txt"
set fld=fso.getfile ("D:/madhu.txt")


To move File one path to other Path

fso.movefile "D:\madhu","D:\Sree Harsha\"


To copy File to other path

FSO.copyfile "D:\madhu","D:\Sree Harsha\"


To get List of subfolder and count of Subfolder

Set fso = CreateObject("Scripting.FileSystemObject")

Set b = fso.GetFolder("d:\madhu")
Set c = b.SubFolders
msgbox typename "c"
foldercount=c.Count
msgbox foldercount
For Each d in c
e=e&d.name&vbnewline
Next
msgbox e

Comments 3 comments

madhuwillb profile image

madhuwillb 4 years ago from Bangalore Author

thank you very much for your valuable comment


vamsi 4 years ago

good hub


madhuwillb profile image

madhuwillb 4 years ago from Bangalore Author

please submit your valuable comments

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working