Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 10th March 2010, 00:53   #1
wrybread
Junior Member
 
Join Date: Oct 2007
Posts: 11
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?
wrybread is offline   Reply With Quote
Old 10th March 2010, 06:09   #2
redxii
Senior Member
 
Join Date: Nov 2005
Posts: 113
Re: How to preserve a file if it exists?

Here is one method:

code:

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.
redxii is offline   Reply With Quote
Old 10th March 2010, 06:26   #3
wrybread
Junior Member
 
Join Date: Oct 2007
Posts: 11
Thank you! Works perfectly.

Last edited by wrybread; 10th March 2010 at 06:59.
wrybread is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump