It copies one or more files from one location to a new location.
Syntax: fso.CopyFile (source, destination[, overwrite]).
fso: (Required) The name of a FileSystemObject object previously instantiated.
source: (Required) A character string file specification, which can include wildcard characters, for one or more files to be copied.
destination: (Required) Character string destination where the file or files from source are to be copied.Wildcard characters are not allowed in the destination string.
overwrite: (Optional) Boolean value that indicates if existing files are to be overwritten. If True, files are overwritten; if False, they are not. The default is True. Note that CopyFile will fail if destination has the read-only attribute set, regardless of the value of overwrite.
Set fso=createobject("Scripting.FileSystemObject") 'File to be copied Sourcefile="C:copy.txt"'Dest folder where the file has to be copied. Destination="D:final1" 'If the destination doesnot exist then create the destination folder. If fso.FolderExists(Destination) = false Then fso.CreateFolder (Destination) End If 'Copy the file fso.CopyFile Sourcefile,Destination,True Set fso=nothing