简体   繁体   中英

Take backup of files from destination folder before installing in Inno Setup

I am using the Inno setup to copy some files from the source directory on my desktop to a folder in the destination computer where I run the Inno Setup. However, before I actually start transferring the files, I wish to take the backup of certain files that will eventually be overwritten.

I am using the [Files] section of Inno setup to set the source and destination location

Source: "{#MyLocalDir}\Controller\bin\Release\*"; \
    DestDir: "{app}\Controller"; \
    Flags: ignoreversion recursesubdirs createallsubdirs;

This works absolutely fine, however, I wish to take the backup of some files from the destination folder into another directory in the destination folder to perform some audit on the file. I use the below code and it doesn't work

Source: "{app}\Controller\Controller.exe.config"; \
    DestDir: "{app}\PrevVersion\Controller\Controller.exe.config"; \
    Flags: ignoreversion recursesubdirs createallsubdirs;

It gives the error that the location doesn't exist. Please help

If you want to copy files from the destination machine (as opposite to installing files from the source machine [the machine where you compile the installer]), you have to use external flag . That also allows you to use constants (such as {app} ) in the Source parameter.

[Files]
Source: "{app}\Controller\Controller.exe.config"; \
    DestDir: "{app}\PrevVersion\Controller\Controller.exe.config"; \
    Flags: external ignoreversion recursesubdirs createallsubdirs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM