Copying a Folder/Directory in VB Script

We can copy a folder from one place to another using the CopyFolder function. While copying all the contents of the folder will be copied. Following is the syntax of CopyFolder function

CopyFolder Source, Destination, Overwrite

The argument source is the folder to be copied

The argument destination is the destination folder. It should be ending with a backslash (\). The destination folder should be an already existing folder. Source folder will be copied inside the destination folder. 

The argument overwrite is an optional boolean argument. True means, if same folder exists in destination, it will be overwritten. False means, vb script will generate an error if same folder exists in destination. The default value is False

Following is an example vbscript to copy a folder from one location to another 

Set FS = CreateObject("Scripting.FileSystemObject")

FS.CopyFolder "C:\Source Folder", "C:\Destination Folder\"
Powered by Bullraider.com