Saturday, May 05, 2007

FSO Copy Files / Folders

Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
FileSystemObject.CopyFile source,destination,1

FileSystemObject.CopyFolder source,destination,1
ARGUMENTS
source , destination, overwrite

N.b
VBScript create object syntax:
Set objFSO = CreateObject("Scripting.FileSystemObject")
WSH create object syntax:
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")

VBS & WSH do treat the above differently if parameters are used - see:
http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_lubv.mspx?mfr=true
heading "Comparing VBScript CreateObject and GetObject Functions with WSH".
 

No comments: