Require overwrite confirmation for one specific file in Inno Setup, install other files in directory unconditionally

TTalma

I have a directory (Configurationfiles) containing 84 files. One of these files contains data that the user will modify (UserData.json). This file may or may not be there, but if it is I don't want to lose this data, and am trying to keep the install user friendly.

I am trying to modify an existing an install script that does all of the following:

  1. If there are no files in the directory, copy all of them
  2. If there are files overwrite all files except UserData.json
  3. if UserData.json is missing copy default UserData.json
  4. If UserData.json is present prompt user to overwrite UserData.json, if yes overwrite, if no don't

Currently all of the files are copied no matter what and I never get a prompt to overwrite. This is what I have so far:

#define ExcludeFiles "UserData.json"

Source: ..\..\PROV\4200701\BIN\*.*; Excludes: {#ExcludeFiles }; DestDir: {app}\BIN; \
  Flags: ignoreversion recursesubdirs skipifsourcedoesntexist;

Source: ..\..\PROV\4200701\BIN\Configurationfiles\UserData.json; \
  DestDir: {app}\BIN\Configurationfiles; 
  Flags: ignoreversion onlyifdoesntexist confirmoverwrite skipifsourcedoesntexist; 

I think I have something set up incorrectly with the flags. But I am not sure. Does anyone see where I am going wrong?

pimpo

You can never get the confirmation, as the onlyifdoesntexist prevents the confirmoverwrite from ever taking any effect.

I do not think, that you are correct with "all of the files are copied no matter". When I test your script, I get:

2020-09-26 16:51:21.625 -- File entry --
2020-09-26 16:51:21.626 Dest filename: C:\Users\pimpo\AppData\Local\My Program\BIN\Configurationfiles\UserData.json
2020-09-26 16:51:21.626 Time stamp of our file: 2020-09-26 16:49:30.000
2020-09-26 16:51:21.626 Dest file exists.
2020-09-26 16:51:21.626 Skipping due to "onlyifdoesntexist" flag.


If you remove the onlyifdoesntexist, your script should do what you want.

2020-09-26 16:57:41.066 -- File entry --
2020-09-26 16:57:41.067 Dest filename: C:\Users\pimpo\AppData\Local\My Program\BIN\Configurationfiles\UserData.json
2020-09-26 16:57:41.067 Time stamp of our file: 2020-09-26 16:49:30.000
2020-09-26 16:57:41.067 Dest file exists.
2020-09-26 16:57:41.067 Time stamp of existing file: 2020-09-26 16:49:30.000
2020-09-26 16:57:41.067 Message box (Yes/No):
C:\Users\pimpo\AppData\Local\My Program\BIN\Configurationfiles\UserData.json

The file already exists.

Would you like Setup to overwrite it?
2020-09-26 16:57:43.055 User chose Yes.
2020-09-26 16:57:43.055 Installing the file.
2020-09-26 16:57:43.062 Successfully installed the file.


You might want to remove the ignoreversion too, as it has no effect on .json files. It may confuse others. The skipifsourcedoesntexist is also questionable.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Inno Setup - Preserve a single existing file, but install all other in a directory tree

From Dev

Inno Setup: List all file names in an directory

From Dev

With Inno Setup how can I rename and copy a file a user chooses (an image) to the program files directory

From Dev

Inno Setup: Install other installer and run it before continuing my install

From Dev

Cat one .csv file with all other files in directory

From Dev

Install IIS with Inno Setup

From Dev

Inno Setup - install files based on feature and automatic update

From Dev

Install external file from subdirectory (relative path) using Inno Setup

From Dev

Install external file from subdirectory (relative path) using Inno Setup

From Dev

Shell: move files one by one an other directory

From Dev

Ubuntu Server setup: How to install Ubuntu on one drive and use other drive for file storage?

From Java

How to catch the error message of bat file for deleting files in Inno Setup?

From Dev

Inno Setup Copy Files and Folders to an Existing Zip File

From Dev

Inno-setup pack all files in a folder exept for 1 file

From Dev

Inno-setup pack all files in a folder exept for 1 file

From Dev

virtual host setup points to other directory(one directory down)

From Dev

Inno Setup second temporary directory

From Dev

Install font with Inno Setup if the version of the font in the setup is higher than one installed

From Dev

Install font with Inno Setup if the version of the font in the setup is higher than one installed

From Dev

Inno Setup: Install only if not VERYSILENT

From Dev

Default Values to Inno Setup install

From Dev

Inno setup code to install python

From Dev

Inno Setup: Install only if not VERYSILENT

From Java

Find the files existing in one directory but not in the other

From Dev

Copying hidden files in Inno Setup

From Dev

list of .csv files in one specific directory

From Dev

Inno Setup - How to edit a specific line from a text file during setup?

From Dev

JavaFX Self Installer With Inno Setup 5 - Allow user to change install directory

From Dev

How to take the Office's install directory from registry for an Inno Setup installer

Related Related

  1. 1

    Inno Setup - Preserve a single existing file, but install all other in a directory tree

  2. 2

    Inno Setup: List all file names in an directory

  3. 3

    With Inno Setup how can I rename and copy a file a user chooses (an image) to the program files directory

  4. 4

    Inno Setup: Install other installer and run it before continuing my install

  5. 5

    Cat one .csv file with all other files in directory

  6. 6

    Install IIS with Inno Setup

  7. 7

    Inno Setup - install files based on feature and automatic update

  8. 8

    Install external file from subdirectory (relative path) using Inno Setup

  9. 9

    Install external file from subdirectory (relative path) using Inno Setup

  10. 10

    Shell: move files one by one an other directory

  11. 11

    Ubuntu Server setup: How to install Ubuntu on one drive and use other drive for file storage?

  12. 12

    How to catch the error message of bat file for deleting files in Inno Setup?

  13. 13

    Inno Setup Copy Files and Folders to an Existing Zip File

  14. 14

    Inno-setup pack all files in a folder exept for 1 file

  15. 15

    Inno-setup pack all files in a folder exept for 1 file

  16. 16

    virtual host setup points to other directory(one directory down)

  17. 17

    Inno Setup second temporary directory

  18. 18

    Install font with Inno Setup if the version of the font in the setup is higher than one installed

  19. 19

    Install font with Inno Setup if the version of the font in the setup is higher than one installed

  20. 20

    Inno Setup: Install only if not VERYSILENT

  21. 21

    Default Values to Inno Setup install

  22. 22

    Inno setup code to install python

  23. 23

    Inno Setup: Install only if not VERYSILENT

  24. 24

    Find the files existing in one directory but not in the other

  25. 25

    Copying hidden files in Inno Setup

  26. 26

    list of .csv files in one specific directory

  27. 27

    Inno Setup - How to edit a specific line from a text file during setup?

  28. 28

    JavaFX Self Installer With Inno Setup 5 - Allow user to change install directory

  29. 29

    How to take the Office's install directory from registry for an Inno Setup installer

HotTag

Archive