Archive: Mass directory and file creation


Mass directory and file creation
Is there anywhere where I can have a whole folder (with many sub folders and files) copied to a specified location at the target system?

I am doing this as I want to create an installer for my web application that runs on Tomcat. I am figuring out how to get Tomcat installed using my own customized installer.

I have the following line in my nsi file that gets all the files and sub folders in "apache-tomcat-5.5.27" to be compiled into the installer:
File /r apache-tomcat-5.5.27\*.*

I noticed that if at the target path, when the folder structures are created, the files will be extracted correctly into the respective folder. But I do not want to have have many CreateDirectory command just to create the whole folder structure before the files can be extracted and populated correctly.

I have tried zip2exe as well, meaning that from my installer, I ExecWait the generated apache-tomcat-5.5.27.exe file. This is not a very elegant way of doing things. Is it possible to have it execute in silent mode?


File /r will create the directory structure for you and SetOutPath will create the directory where you want the files to be extracted. There's no need to ever call CreateDirectory in your case.


It works now with the current codes:

SetOutPath $INSTDIR
CreateDirectory "$INSTDIR\apache-tomcat-5.5.27"
DetailPrint "Copying the Tomcat zip files"
SetOutPath "$INSTDIR\apache-tomcat-5.5.27"
File resources\tomcat.ico
File /nonfatal /r apache-tomcat-5.5.27\*.*

I still have to create the folder first before extracting the files from the apache-tomcat-5.5.27 folder, else it would be all extracted to the root of $INSTDIR (meaning not in the apache-tomcat-5.5.27 folder).

Thanks kichik!