Page 1 of 1

Move existing files to a new folder

Posted: Tue Jun 10, 2014 9:24 am
by Viper786
Hello, I am new to InstallAware and currently my application is being installed using a different installer. Using InstallAware, after a user selects the folder to install the application to, if that folder already exists, I want to move everything in that folder to a new folder called ApplicationName.old. Can anyone help me figure out how to do this?

Thanks!

Re: Move existing files to a new folder

Posted: Tue Jun 10, 2014 11:10 am
by FrancescoT
Dear Viper786,

use the command "Copy/Move Local Files" to copy or move files that are already present on the target system (or installation media) into a new location on the target system.

Regards

Re: Move existing files to a new folder

Posted: Tue Jun 10, 2014 11:16 am
by Viper786
Thanks for the reply. Do I do something like this?

Source Folder: $TARGETDIR$
Source Files: *.*

Target folder: $TARGETDIR$\newfolder
Target Files: *.*

and select Move Files and check Include Subfolders?

Re: Move existing files to a new folder

Posted: Tue Jun 10, 2014 11:38 am
by FrancescoT
yes, you are correct ... but please note that "Include Subfolders" option only works with native engine.

Notes

With the Windows Installer engine, files copied or moved by this command are not removed upon uninstallation. Therefore, if removal of such files is required, accompany each Copy/Move Local Files command with a Delete Files command that is set to undo the copy/move local action.
The Native Engine does not have this limitation and files copied/moved by this command will be uninstalled normally without requiring manual deletion


Regards

Re: Move existing files to a new folder

Posted: Tue Jun 10, 2014 11:54 am
by Viper786
Thanks for the reply. How do I enable the native engine?

Re: Move existing files to a new folder

Posted: Wed Jun 11, 2014 10:41 am
by FrancescoT
Example;
Set Variable NATIVE_ENGINE to TRUE
Copy/Move Local Files ...
Set Variable NATIVE_ENGINE to FALSE

For more information on NATVE ENGINE please refer to included IA documentation.

Regards

Re: Move existing files to a new folder

Posted: Wed Jun 11, 2014 1:00 pm
by Viper786
Thank you for the reply. This is what it looks like now:

Set Variable NATIVE_ENGINE to TRUE
Move Local Files $TARGETDIR$\*.* to $TARGETDIR$\newfolder\*.* (include subfolders)
Set Variable NATIVE_ENGINE to FALSE
Apply Install (get results into variable SUCCESS)

It moves the files to the new folder, but not the folders. I tried going through the documentation but I can't figure out what I am doing wrong. Can you please help me?

Re: Move existing files to a new folder

Posted: Thu Jun 12, 2014 7:42 am
by FrancescoT
Did you read the NATIVE ENGINE documentation?

This happens because the TARGETDIR is not already available on the target OS when you execute the "Move Local Files" command.
The TARGETDIR is effectively available after Apply Install execution only.

Please have also a look at the following link.
http://www.installaware.com/forum/viewtopic.php?f=2&t=4338

Regards

Re: Move existing files to a new folder

Posted: Thu Jun 12, 2014 8:12 am
by Viper786
Thank you for the reply. Sorry for all my questions, I am very new to InstallAware and building MSIs. Can you recommend what I can do to achieve what I am trying to do? Move all files and folders if the folder exists to a new folder.

Re: Move existing files to a new folder

Posted: Thu Jun 12, 2014 10:10 am
by FrancescoT
Yes, copy/move that files only if the folder exist.

Regards

Re: Move existing files to a new folder

Posted: Mon Jun 16, 2014 7:33 am
by Viper786
Sorry, I don't think i understood your last reply. I am trying to move files AND folders if the folder already exists but using the file copy/move it is only moving the files because as you said, TARGETDIR is not already available on the target OS. What can I do differently to achieve this?

Re: Move existing files to a new folder

Posted: Mon Jun 16, 2014 11:56 am
by FrancescoT
I mean something as below;

Code: Select all

Comment: Check if your directory already Exist
Set Variable MYFOLDER_EXIST to FALSE
Does Folder Exist C:\xxxxx (get result into variable MYFOLDER_EXIST)
 
Comment: .... Install files commands
 
Apply Install

if Variable SUCCESS Equals COMPLETE
  if Variable MYFOLDER_EXIST Equals TRUE
    Set Variable NATIVE_ENGINE to TRUE
    Copy Local Files \ to     Set Variable NATIVE_ENGINE to FALSE
  end
end


Regards