I want to first rename an existing file ‘My program old’ to ‘My program v2’ but only if ‘My program v2’ doesn’t already exist.
Then I want to rename ‘My program’ to ‘My program old’ but only if ‘My program old’ doesn’t already exist.
And then I want to install ‘My program’ from the installer but only if ‘My program’ doesn’t already exist.
I would be very grateful for any guidance !
I would give a try to something like this. In the
ssInstallstage of theCurStepChangedevent, which occurs just before the installation process starts, just check if the file doesn’t exist with theFileExistsfunction, and if not, then just call theRenameFilefunction, which will silently fail if the source file doesn’t exist, so you don’t need to care if the source file exists. In the[Files]section you can then use theonlyifdoesntexistflag for your last requirement. You can follow thecommented versionof this script if you want: