dave7802
Posts: 3
Joined: Fri Dec 10, 2021 2:25 pm

Adding conditions to files and folders

Tue Dec 14, 2021 4:58 pm

Hi

I am new here, so please go easy one me.
I have spent a good solid few days getting to grips with the software and conditions.

I have managed to get a installer working how i need it (Its basically combining 25 different installers based on conditions)
This will save a massive amount of time.

But i want to make this flawless, So to do this i have also included the use of Files and Folders.
Copying out files to a set directory.

Now the files on the target computer are important and unique, overwriting these files can cost many hours rebuilding.

All i want to do (And i my head its simple)

Is add a condition on the Folders to NOT copy if the folder or file is present. (Regardless of any applications installed, as they are PreRequisites there is a wide selection of conditions, If the OS is X, is its 32 and 64.
And then depending on what programs we are installing, so i cannot match it on if program is installed.

I cannot find a condition that meets this, and when i google and search these forums everyone wants the installer to HALT or exit.
I just simple want the installer to carry on but NOT copy of the directory / files if the folder is present.

If (Empty (MyDirName)) {
Copy Folder X to Z
}

For example:
WIndows Volume/MyDirName

If this folder is present, i want the installer to continue, but just not copy of / overwrite these files.
In my Files and Folders / Shortcuts i have
WIndows Volume/MyDirName
WIndows Volume/MyDirName/MoreDirs
WIndows Volume/MyDirNameSomeFiles
WIndows Volume/MyDirName/EvenMoreDirs
And so on, (There is a total of 50 files and folders within this one directory)

The rule can be either, if the file is present DO NOT OVERWRITE
or simply if the folder WIndows Volume/MyDirName is prent Skip copying this directory

If it makes a difference i have alot of other files and folders being copied over to other parts of the system, and these files and folders need to copy over regardless of the above rule is met or not.

I know the conditions a little, as i have multiple registry being imported depending if its 32 or 64 bit
But i just cannot figure out a simple condition to my scenario

If anyone can help me i would be greatly appreciative

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Adding conditions to files and folders

Wed Dec 15, 2021 7:10 pm

Hello Dave,

For this request, you could right click on your folder --> "Properties" --> "Operations" tab --> "Overwrite behavior" and set it to "Do not overwrite existing files".

This way, if the file is present on the machine, it will not be overwritten. You can test this using simple .txt files. For instance, create on your disk the following folder:

Code: Select all

C:\test
In the above folder, add the "test.txt" file, containing the following: "test".

In your Advanced Installer project, in the "Files and Folders" page, create a "regular" folder under "Windows Volume" and name it "test". In it, add another file with the same name that contains "testtest". Follow the above steps and install the setup.

After the installation, the test.txt file should have the following string in it: "test" (the file should not be overwritten with "testtest").

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

dave7802
Posts: 3
Joined: Fri Dec 10, 2021 2:25 pm

Re: Adding conditions to files and folders

Thu Dec 16, 2021 12:16 pm

Thank you very much for this, Ill be honest i didn't even think of clicking proprieties (I just assumed it would of given me the default windows one)

Can confirm this worked as expected.
Thanks again

Liviu
Posts: 1035
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Adding conditions to files and folders

Thu Dec 16, 2021 4:08 pm

You are always welcome, Dave!

We are glad that everything is working as expected now!

Please let us know if there is anything else we could help you with.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”