remove '.part1' from Output directory in 7z

194 views Asked by At

I have 2 files test.part1.rar and test.part2.rar When extracting them using command

7z x -o* test.part1.rar

The output directory is a folder with test.part1 name I want the output directory to be a folder with name test (archive name without '.part1')

    From 7z documantation
    
        -o{dir_path}
        {dir_path}
        This is the destination 
directory path. It's not required to end with a backslash. If you specify * in {dir_path}, 7-Zip substitutes that * character to archive name.
1

There are 1 answers

2
theherk On BEST ANSWER

Maybe using parameter expansion will do what you seek.

f=test.part1.rar; 7z x -o ${f%%.*} $f

You may want to use the 7z e command if you don't want to extract with the full paths within the archive.

The * can be used within the output directory to be replaced by the archive name. It doesn't sound like you need that.