File copy and rename question - Advanced Installer Community
hsc
Posts: 117
Joined: Wed Mar 02, 2016 2:55 pm

File copy and rename question

My installer must copy and rename a file if a condition is met.

The file to copy is included in the installer project as a temporary file with the name "template.par". It should be copied and renamed to a directory and a file name that depend on user input. The destination directory and name are generated by a PowerShell script which processes user input and other criteria. The script creates the properties PARFILE_PATH, PARFILE_DIR, and PARFILE_NAME which contain the full path, the directory, and the name & extension of the copy/rename target. The same script also creates the PARFILE_ACTION property. The file copy/rename action should only be executed if this property has the value "CREATE". (Adding the condition to the action is the easy part.)

I tried it to copy the file with a "Copy/Move File" custom action but it failed with an unclear error situation. I assume the destination of this operation must be a directory name, not a directory and file name.

I also tried to add a "File Copy/Move" action to the "Files and Folders" page but I got lost when I tried to specify the destination folder. Further, I am unsure whether or not I can use properties in this place.

What is the best way to achieve what I want to do, other than writing another PowerShell script?

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

Re: File copy and rename question

Hello Hans,

Can you please send us the .AIP (setup project) file by email to support at advancedinstaller dot com so we can check its settings?

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
hsc
Posts: 117
Joined: Wed Mar 02, 2016 2:55 pm

Re: File copy and rename question

Hello Liviu, your email server rejected the email. The ZIP attachment contained none of the file types which Google lists as potentially harmful. Any alternatives?

mx.google.com gave this error:
This message was blocked because its content presents a potential security issue.

Regards
Hans
Liviu
Posts: 1419
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: File copy and rename question

Hello Hans,

I've sent you an email with an upload link.

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

Return to “Common Problems”