1. Create Folder
Using VBScript
Set objFSO =
CreateObject("Scripting.FileSystemObject") 'create file system object
objFSO.CreateFolder("D:\techvbscript\VBScript")
'create
‘VBScript’ folder in “D:\techvbscript”
Set objFSO =
Nothing 'release the object
2. Delete Folder
using VBScript
Set objFSO =
CreateObject("Scripting.FileSystemObject") 'create file system object
strFolderPath
= "D:\techvbscript\VBScript" 'set the folder path
If
objFSO.FolderExists(strFolderPath) then 'check if folder exists
objFSO.DeleteFolder(strFolderPath) 'delete the folder
MsgBox "Folder Deleted"
End If
Set objFSO =
Nothing 'release the object
3. Copy Folder
using VBScript
strSrcPath =
"D:\techvbscript\VBScript"
'set the source folder path
strDesPath =
"D:\techvbscript\temp"
'set the
destination folder path
set objFSO =
CreateObject("Scripting.FileSystemObject") 'create file system object
If
objFSO.FolderExists(strSrcPath) and objFSO.FolderExists(strDesPath) then 'checks if folders exist
objFSO.copyfolder strSrcPath,strDesPath 'copy all the files from source folder to
destination folder
Else
MsgBox "Folder not exist"
End IF
Set objFSO =
Nothing 'release the object
4. Move Folder
using VBScript
strSrcPath =
"D:\techvbscript\VBScript"
'set the source folder path
strDesPath =
"D:\techvbscript\temp\"
'set the
destination folder path
set objFSO =
CreateObject("Scripting.FileSystemObject") 'create file system object
If objFSO.FolderExists(strSrcPath)
and objFSO.FolderExists(strDesPath) then 'checks if folders exist
objFSO.movefolder strSrcPath,strDesPath1 'move source folder to destination
"D:\techvbscript\temp\VBScript"
Else
MsgBox "Folder not exist"
End If
Set objFSO =
Nothing 'release the object
No comments:
Post a Comment