copy files from appropriate folder - Page 2 - Advanced Installer Community
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: copy files from appropriate folder

Hello,

I'm very sorry, but I'm afraid it is still unclear to me what you are trying to achieve. What do you mean by "I need to copy 'fileX' to 'file'"? Do you want to copy the content of the "fileX" to the existing content of the "file"?

Or do you have multiple versions of the same file named like this: file, file1, file2, file3, etc and depending on the user selection you want to install only one of the above files and rename it to "file"? If so, the only option for this will be to use the How to install two files with the same name in the same folder approach. There is no other solution. Therefore, you will have to add all the fileX files in subfolders of the target folder.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sitesv
Posts: 15
Joined: Tue Jan 26, 2016 10:35 am

Re: copy files from appropriate folder

Daniel wrote:Hello,
...
Therefore, you will have to add all the fileX files in subfolders of the target folder.
Hello, Daniel!
I create a subfolders for each file. As a result, in target folder i see only one file without my subfolders.How to leave this subfolders? Thanx!

In addition:
File is not overwritten if i check 'Install folder content into the parent folder' for subfolder.

I have a 2 steps install process:
1. Copy file from subfolder to folder on the basis of the selection conditions. [delete subfolders after coping]
2. Copy result from folder to main folder.

Files have a binary format, not text.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: copy files from appropriate folder

Hi,

I'm afraid that copying a file from a folder to a parent folder and then, from that parent folder to another folder is not possible. The content of a folder can be copied to its parent folder once. In this case, you need to copy your file directly to the main folder.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sitesv
Posts: 15
Joined: Tue Jan 26, 2016 10:35 am

Re: copy files from appropriate folder

Eusebiu wrote:Hi,

I'm afraid that copying a file from a folder to a parent folder and then, from that parent folder to another folder is not possible. The content of a folder can be copied to its parent folder once. In this case, you need to copy your file directly to the main folder.

Best regards,
Eusebiu
Hello!
1. Is there possible to create a script for this manipulations? Base functionality of install process does not meet our requirements.
2. If i set 'Install files to parent folder...' for folder, this folder removes after copying files... Is it possible to leave folder without deleting?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: copy files from appropriate folder

Hi,
1. Is there possible to create a script for this manipulations? Base functionality of install process does not meet our requirements.
Yes, you can create your own inline script or custom action to copy the files you need from a folder to another.
2. If i set 'Install files to parent folder...' for folder, this folder removes after copying files... Is it possible to leave folder without deleting?
I'm afraid that this is the normal behavior. If you want to leave those folders without deleting them, you can duplicate them with ones that does not have the "Install folder content to parent..." option set.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sitesv
Posts: 15
Joined: Tue Jan 26, 2016 10:35 am

Re: copy files from appropriate folder

Eusebiu wrote:Hi,
1. Is there possible to create a script for this manipulations? Base functionality of install process does not meet our requirements.
Yes, you can create your own inline script or custom action to copy the files you need from a folder to another.
2. If i set 'Install files to parent folder...' for folder, this folder removes after copying files... Is it possible to leave folder without deleting?
I'm afraid that this is the normal behavior. If you want to leave those folders without deleting them, you can duplicate them with ones that does not have the "Install folder content to parent..." option set.

Best regards,
Eusebiu
Hi!
To create a 'copy' in my vbScript, should i work with APPDIR? Is there some examples?
'APPDIR\file' is not exist while i trying to test 'Installation UI'. How to fix it? Thanx
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: copy files from appropriate folder

Hi,

To use a property in a VBScript custom action, you can use the "Session.Property()" function. For example, you can initialize a variable with the value of the "APPDIR" property, then use that variable in your code: DestinationFolder = Session.Property("APPDIR")

You can take a look on the "VBScript to copy a file from Source directory" article.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sitesv
Posts: 15
Joined: Tue Jan 26, 2016 10:35 am

Re: copy files from appropriate folder

Eusebiu wrote:Hi,

To use a property in a VBScript custom action, you can use the "Session.Property()" function. For example, you can initialize a variable with the value of the "APPDIR" property, then use that variable in your code: DestinationFolder = Session.Property("APPDIR")

You can take a look on the "VBScript to copy a file from Source directory" article.

Best regards,
Eusebiu
Hi!
Should i use script after all files installation process?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: copy files from appropriate folder

Hi,

Yes, you need to place the script after the "Add Resources" action group and set the "deferred" with "no impersonation" options for it. In order to access properties from a deferred custom action, please take a look on the "can't access property from vbscript" thread.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sitesv
Posts: 15
Joined: Tue Jan 26, 2016 10:35 am

Re: copy files from appropriate folder

Eusebiu wrote:Hi,

Yes, you need to place the script after the "Add Resources" action group and set the "deferred" with "no impersonation" options for it. In order to access properties from a deferred custom action, please take a look on the "can't access property from vbscript" thread.

Best regards,
Eusebiu
Hi!
What the difference between placing script after 'Add Resources' or after 'Finish Execution'?

APPDIR and input Action data parameters have the same result (my target dir).

I don't want copy all files at first step. I just want to copy files by my script.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: copy files from appropriate folder

Hi,

There is not a big difference between placing the script after the "Add Resources" or after "Finish Execution" action groups. Just that you need to place it at least after the "Add Resources" action groups because your files will not be on the machine at an earlier point.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”