Quote:
> > Jscript way I:
> > var oFSO = new ActiveXObject("Scripting.FileSystemObject");
> > var sMySrc = "C:\\Mes documents";
> > var sMyDest = "E:\\Mes documents";
> > oFSO.CopyFolder (sMySrc, sMyDest);
> > WScript.Echo("Done!");
> it works fine but only once, or if the disk is blank.
> it does'nt overwrite
> Could you make it overwrite ?
> laurent seghi
If you look at docs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/scri...
You will see this for CopyFolder method:
object.CopyFolder ( source, destination[, overwrite] );
object
Required. Always the name of a FileSystemObject.
overwrite
Optional. Boolean value that indicates if existing folders are to be overwritten.
If true, files are overwritten; if false, they are not. The default is true.
It implies that with third parameter set to 'true' same as without it
(since it is optional), CopyFolder method should overwrite destination.
But it does not (as you can see). Instead - better think of it as of
"CopyFolderOnlyOnce" method ;))
Seriously, the problem is with file attributes. Some of files/folders
that you copied first time have read only attribute set. CopyFolder
fails to overwrite such a file/folder regardless of overwrite flag value.
You could script around it by recursively resetting read only flags
on destination folder prior to calling CopyFolder method or - you
could go for shamefully simple - one liner DOS batch solution...
Branimir