The
copy command has a
/v switch for verifying the output data is written correctly. It may slow down the copy operation.
Additionally I would like to run the copy command without xp_cmdshell (creating a job /batch file and schedule it using Windows task scheduler)
The command shell acts as the interpreter for batch files. Windows will open a command shell whenever a batch file is run, the scheduler and the run box are
not exceptions.
You can however bypass the command shell by using any of the windows script languages (vbscript, jscript, rexx, python and many more)
The is a vbscript solution:
Const FOF_CREATEPROGRESSDLG = &H0&
strTargetFolder = "D:\Scripts"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(strTargetFolder)
objFolder.CopyHere "C:\Scripts\*.*", FOF_CREATEPROGRESSDLG
In this example, d:\scripts is the target folder and c:\scripts is the source folder. Save the script with a
vbs extension and run from the command prompt as
cscript scriptname.vbsPS. The progress bar is built into the CopyHere method.
Note: script uses mapped drives but should work with UNC tagging also