Overwrite file in folder


need help, unexperienced in windows scritping , tryin figure out how to  copy file 1 folder (test1) (test2), if file exits in destination being copied should overwritten , 1 test1 folder remains (as in replace existing one).
gurus out there help?


'file search for
targetacquired = olddmcl

'source , destination folders
source = "c:\test1\"
dest = "c:\test2\"

set fso = createobject _
("scripting.filesystemobject")

'get files in source folder
set folder = fso.getfolder (source)
set files = folder.files

'loop through files
'if file called dmcl
'copy dest folder

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 !"

hi timm32,

 

as issue seems related development/coding, focus on file services , storage question here, not best support resource development. quick , better support on scripting/coding, recommend initial new thread further support in msdn forum. community members , support professionals there more familiar script , can give support in efficient way.

 

for convenience, have list link msdn forum.

 

msdn forum

http://social.msdn.microsoft.com/forums/en-us/categories/

 

thanks understandings.


this posting provided "as is" no warranties, , confers no rights.


Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file