PanCotzky
PanCotzky

Reputation: 574

Add folder contents to .rar through console commands without adding folder itself

Here's a question:

I have a folder named Root and it contains some files and folders. Using Winrar console commands, I need to create an archive Root.rar that should contain entire file/folder structure of Root and SHOULDN'T contain Root folder itself.

For example:

On drive:

Root-
    |-SomeFile
    |-SomeFolder-
                |-SomeOtherFile

In the Root.rar archive:

SomeFile
SomeFolder-
          |-SomeOtherFile

I tried to do this:

"C:\Program Files\WinRAR\winrar.exe" a -r Root.rar Root\*

But it also adds the Root folder. Then I tried this:

"C:\Program Files\WinRAR\winrar.exe" a -ep -r Root.rar Root\*

In this case winrar didn't add the Root folder, but it also didn't add any other folders, and instead of folder tree I've got a bunch of unstructured files. Is there any way of adding the folder structure, ignoring the Root?

Thank you!

Upvotes: 2

Views: 534

Answers (1)

MC ND
MC ND

Reputation: 70923

Use -ep1 (exclude base folder names) instead of -ep (exclude paths from names)

Upvotes: 2

Related Questions