Submitted By: Brett

Copies a folder to a new location.

Visual Basic
Edit|Remove
Dim CopyFromPath, CopyToPath 
Const WINDOW_HANDLE = 0
Const NO_OPTIONS = 0
Const OverwriteExisting = TRUE

Set objShell = CreateObject("Shell.Application") 
Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE,"Select folder to copy:",NO_OPTIONS,ssfDRIVES)

if (not objFolder is nothing) then
	Set objFolderItem = objFolder.Self 
	CopyFromPath = objFolderItem.Path
else 
	Set objShell = nothing
	WScript.Quit(0)
end if

Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, "Where should the folder be copied to?:", NO_OPTIONS, ssfDRIVES) 
if (not objFolder is nothing) then
	Set objFolderItem = objFolder.Self 
	CopyToPath = objFolderItem.Path
else 
	Set objShell = nothing
	WScript.Quit(0)
end if

Set objFolder = nothing
Set objFolderItem = nothing
Set objShell = nothing

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile CopyFromPath & "\*.*", CopyToPath & "\", OverwriteExisting
msgbox "The folder has now been copied to " & CopyToPath