Move existing files to a new folder

Got a problem you cannot solve? Try here.
Viper786
Posts: 6
Joined: Tue Jun 10, 2014 9:22 am

Move existing files to a new folder

Postby Viper786 » Tue Jun 10, 2014 9:24 am

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!

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Move existing files to a new folder

Postby FrancescoT » Tue Jun 10, 2014 11:10 am

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Viper786
Posts: 6
Joined: Tue Jun 10, 2014 9:22 am

Re: Move existing files to a new folder

Postby Viper786 » Tue Jun 10, 2014 11:16 am

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?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Move existing files to a new folder

Postby FrancescoT » Tue Jun 10, 2014 11:38 am

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Viper786
Posts: 6
Joined: Tue Jun 10, 2014 9:22 am

Re: Move existing files to a new folder

Postby Viper786 » Tue Jun 10, 2014 11:54 am

Thanks for the reply. How do I enable the native engine?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Move existing files to a new folder

Postby FrancescoT » Wed Jun 11, 2014 10:41 am

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Viper786
Posts: 6
Joined: Tue Jun 10, 2014 9:22 am

Re: Move existing files to a new folder

Postby Viper786 » Wed Jun 11, 2014 1:00 pm

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?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Move existing files to a new folder

Postby FrancescoT » Thu Jun 12, 2014 7:42 am

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Viper786
Posts: 6
Joined: Tue Jun 10, 2014 9:22 am

Re: Move existing files to a new folder

Postby Viper786 » Thu Jun 12, 2014 8:12 am

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.

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Move existing files to a new folder

Postby FrancescoT » Thu Jun 12, 2014 10:10 am

Yes, copy/move that files only if the folder exist.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Viper786
Posts: 6
Joined: Tue Jun 10, 2014 9:22 am

Re: Move existing files to a new folder

Postby Viper786 » Mon Jun 16, 2014 7:33 am

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?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Move existing files to a new folder

Postby FrancescoT » Mon Jun 16, 2014 11:56 am

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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 149 guests