p7zip icon indicating copy to clipboard operation
p7zip copied to clipboard

[question] Extracting in a dir with the same name as the archive?

Open rado84-github opened this issue 4 years ago • 1 comments

Is there a way to make p7zip to extract the contents of an archive in a directory whose name is the same as the name of the archive? For instance, if the archive name is game1.zip, to extract the contents to "game1/". I know I could manually type the name but I need something that will automatically match the name of the archive along with the spaces in the name, if any.

rado84-github avatar Dec 29 '21 10:12 rado84-github

You can get file without specifies extension ibn bash easily.

$ for FILEZIP in *.zip; do FILE={FILEZIP%.zip}; unzip -d $FILE $FILEZIP; done

Check parameter expansion in bash manual.

tansy avatar Feb 10 '22 20:02 tansy