Search code examples
installationnsisunzip

Nsis script: Trying to write a script which extracts specific directory from a zip file and adds it as a part of installer(executable)


I have zip file say Texas.zip . It contains 2 directories Newyork and Manhattan. Newyork has two files A.txt and B.txt , while Manhattan has C.txt and D.txt. I want to extract only Newyork and 2 files associated inside it. The below script helps me extract a specific file inside Newyork but not the entire directory. Please do tell me how to extract a specific directory and its contents from the zip. SCRIPT:

Section "TEST1"
  InitPluginsDir
    #SetOutpath "$INSTDIR"
      
      nsisunz::UnzipToStack /file  "Texas\Newyork\A.txt" "D:\Files\Texas.zip" "D:\Output folder"
      
      Pop $0
    DetailPrint "$0" ;print message to log
  SectionEnd* 

DESIRED OUTPUT : Inside D:\Output folder\ post installation of the exe i must see D:\Output folder\Newyork * where '*' denotes both files A.txt and B.txt .


Solution

  • This plug-in does not support advanced options like this, you must use nsUnzip instead.

    CabX and some of the 7z plug-ins also supports this if you are willing to change archive format.