Overwrite file in folder
I need some help, am unexperienced in windows scritping and am tryin to figure out how to copy a file from one folder (Test1) to another (Test2), if the file already exits in the destination its being copied to then it should be overwritten and the one from Test1 folder remains (as in replace the existing one). Any gurus out there to help? 'File to search for targetacquired = oldDMCL 'source and destination folders source = "C:\Test1\" dest = "C:\Test2\" set fso = CreateObject _ ("Scripting.FileSystemObject") 'get files in the source folder set folder = fso.GetFolder (source) set files = folder.Files 'loop through the files 'if a file is called dmcl 'copy it to dest folder for each file in files if file.name = targetacquired then WScript.Echo file.Path file.Copy dest, true end if next WScript.Echo "DMCL File updated !"
November 5th, 2009 3:16pm

Hi Timm32, As the issue seems to be related to development/coding, we are mainly focus on the file services and storage question here, we are not the best support resource for development. For quick and better support on scripting/coding, it is recommend you to initial a new thread to get further support in the MSDN forum. The community members and support professionals there are more familiar with script and can give you a support in an efficient way. For your convenience, I have list the link to MSDN forum. MSDN forum http://social.msdn.microsoft.com/Forums/en-US/categories/ Thanks for the understandings.This posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
November 6th, 2009 9:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics