imageconsoleiconswinrarsfx

WinRAR SFX from commandline keeps creating a parent folder after extraction


I am trying to program an automatic SFX creator that integrates all the contents (recursively) form a specified folder.

I successfully managed to do it thanks to some answers in different posts like this or this.

The command I used is the following:

"C:\Program Files\WinRAR\WinRar" a -s -m5 -ep1 -tl -scul -sfx -iicon"C:\InstallerIcon.ico" -iimg"C:\SFXStripe.bmp" -z"c:\winrar_installer_script.txt" "C:\Installer.exe" "C:\Matlab tools"

And it does "almost" what I want.

The thing is that when I execute the installer,I get on the installation path (C:\Installation Path) a folder named C:\Installation Path\Matlab Tools with the desired content inside it, instead of having this content directly placed inside C:\Installation Path.


What I get:

<code>+ C:
    + Installation Path
        + Matlab Tools
            + Folder 1
                - File 1.1
                - File 1.2
            + Folder 2
                - File 2.1
                - File 2.2
</code>

What I want:

<code>+ C:
    + Installation Path
        + Folder 1
            - File 1.1
            - File 1.2
        + Folder 2
            - File 2.1
            - File 2.2</code>

My question is:

Is there any way to get rid of the original parent folder (Matlab tools), but preserving the structure inside?


Solution

  • I think I got it... finally!

    Just using the flags -ep1 -r, along with an asterisk after the original folder C:\Matlab Tools\*.

    The full instruction remains like this:

    "C:\Program Files\WinRAR\WinRar" a -s -m5 -ep1 -r -tl -scul -sfx -iicon"C:\InstallerIcon.ico" -iimg"C:\SFXStripe.bmp" -z"c:\winrar_installer_script.txt" "C:\Installer.exe" "C:\Matlab tools\*"