Archive: How to preserve a file if it exists?


How to preserve a file if it exists?
I found this recent thread describing how to detect if a file exists:

http://forums.winamp.com/showthread....hreadid=248525

That's a part of what I'm trying to do, but I need to check if a file exists (configuration.ini), and if it does, not overwrite it. I'm packing my files like this:

File /r "C:\myfiles\*"

In other words, I'm packing every file in the source directory, including configuration.ini. What I don't understand is how to skip overwriting configuration.ini on the target computer if the file is present there.

Does anything occur to anyone?


Re: How to preserve a file if it exists?
Here is one method:


File /r /x configuration.ini "C:\myfiles\*"

SetOverwrite off
File "C:\myfiles\configuration.ini"
SetOverwrite on


This excludes configuration.ini so you can single it out with SetOverwrite.

Thank you! Works perfectly.