Eliminate the Error Copying File or Folder

December 9, 2010 at 17:59:49
Specs: Windows XP-Pro SP3, 2.0 GHz, 512MB
When one of the destination folders is the same as the source I get the following prompt:


"Error Copying File or Folder
Cannot copy******* .The source and Destination are the same
OK "

I click the "OK" button and the script continues.

Is it possible to eliminate the prompt?

I would like the script to automatically answer "OK".

This is the Script I use:


set args = wscript.Arguments
set objShell = CreateObject("Shell.Application" )

Set objFolder = objShell.NameSpace("D:\Program Files" )
if not objFolder is nothing then
for each item in args
objFolder.CopyHere item, 16
next
End If
Set objFolder = Nothing
'
Set objFolder = objShell.NameSpace("N:\APPS" )
if not objFolder is nothing then
for each item in args
objFolder.CopyHere item, 16
next
End If
Set objFolder = Nothing
'
Set objFolder = objShell.NameSpace("W:\APPS" )
if not objFolder is nothing then
for each item in args
objFolder.CopyHere item, 16
next
End If
Set objFolder = Nothing
'
Set objFolder = objShell.NameSpace("X:\APPS" )
if not objFolder is nothing then
for each item in args
objFolder.CopyHere item, 16
next
End If
Set objFolder = Nothing



See More: Eliminate the Error Copying File or Folder

Report •


#1
December 11, 2010 at 14:45:49
Question: Why are you trying to copy some folder onto itself?

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question