Copying/Moving a file to a separate dir only if it exists - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

JoeLake
Posts: 1
Joined: Fri Jul 21, 2006 8:52 pm

Copying/Moving a file to a separate dir only if it exists

Hola,
I am having an issue with advancedinstaller 4.1.2

What I am needing to do is have a file copied to a separate directory only if that directory exists.

What I am experiencing is if I do an install on a machine where the directory exists, then the installer does what it is supposed to do. If I attempt to install on a machine that the directory does not exist on, then the installer creates the directory structure I provided in the install package and then copies the file (when I don't want it to do this!)

What I have done to date is
1. Create a search of the registry where it looks for a certain key, this key contains the path to the directory I need

2. In Files and Folders I do an add folder based on the above condition.
I then have to add a few more folders to this base structure to make sure the file gets placed in the correct place.


Any ideas or suggestions would be greatly appreciated.

Thanks
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

The problem is that you need to condition the installation of that property based folder created in the "Files and Folders" page. Here is how you can do this:

1. Create a registry search, browse for your registry value. Name the search property like this: REGISTRY
2. Create a folder search (New Search->Add Location->Folder). In the Path field browse for the property that keeps the result of the registry search (the filed must look like this: [REGISTRY]). Name this property like this: FOLDER_EXIST
3. Switch to "Files and Folders" page and create a property based folder (New Folder->Property Based). Choose REGISTRY as property for this folder and add your files in it.
4. Switch to "Organization" page and select the component associated with your files. Condition that component with the following condition: FOLDER_EXIST.
5. Build and run your package.

Please let me know if you encounter any problem.

Regards,
Gigi
_________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”