Skip to content
⌘ NSIS Forum Archive

Copy a directory after install

10 posts

simptz#

Copy a directory after install

Hey guys,

is it possible to copy a directory after the installation with nsis?
Anders#
CopyFiles can copy files and directories and it also works after the instfiles page if that's what you want
simptz#
thanks!

but two question:
1.:
If my program installed successfully, i want do copy some files (copyfiles is ok). But in which function/section can i do this? Section -Post ?

2.:
I tryed CopyFiles in the Section -Post, but it didnt copy my files.
In the function .onInit it did.
Afrow UK#
Any invisible section will be executed unconditionally. Check your CopyFiles statement.

Stu
Comperio#
Just adding on Afrow's comments...

If you want to copy only if there were no errors in the install, then you might consider using the function .onInstSuccess.

If you decide to use a section (such as one named "-post" as you stated earlier), then make sure that section is the last one in your install script. (Sections execute in order from top down.)
simptz#
thanks guys 🙂

but in the .onInstSuccess function, CopyFiles dont work 🙁
here my code:

Function .onInstSuccess

; Updaten
CopyFiles ".\Service Packs\*.*" "$INSTDIR"

FunctionEnd
i want to copy all files in service packs to my installdir (service packs should be a extra folder).
simptz#
Hi Anders,

the problem is: our installer is on a cd and i dont know the path.
or do you have a better suggestion?