Archive: How to overwrite multiple file?


How to overwrite multiple file?
I need to copy many files into installation directory. I use following code to do that:

SetOverwrite on
SetOurDir $INSTDIR
File /r "MyDirTemp"
Rename /REBOOTOK "${INSTDIR}\MyDirTemp\*.*" "${INSTDIR}\MyDir\*.*"

The problem is that open or existing files are not overwritten on system reboot when i use wildcards (*.*)in Rename. If don't use wildcards, then Rename works fine, but have to copy about 1,000 files so it is impossible to use direct filenames.
My question is: How to copy huge amount of files, if any files on target system could exist or be open? How to overwrite these file on system reboot? Do i do anything wrong in my code example?
Thanks


The only thing I could think of is to clear the location first perhaps...

-Stu


I cannot clear the location, because any files could be open. Yes, i could remove old files, restart and install new files, but this is not what i want.


Well, since you're renaming your folder on reboot, you can RMDir /REBOOTOK on the folder first too?

-Stu


So if i would use following code:

;---------------
SetOverwrite on
SetOurDir $INSTDIR
File /r "MyDirTemp"
RMDir /REBOOTOK "MyDir"
Rename /REBOOTOK "${INSTDIR}\MyDirTemp\*.*" "${INSTDIR}\MyDir\*.*"
;----------------

Then on reboot will be "MyDir" removed first and then "MyDirTemp" renamed to "MyDir"?
Do these "onreboot" action work this way? Couldn't it happen that "MyDir" would be removed after it was renamed?
Thanks for help.


I'm sure the dev's would have thought of that, but you might want to check anyway (perhaps you could try an example script and see what happens).

-Stu


It works! Thanks for your help.