p7zip
p7zip copied to clipboard
[question] Extracting in a dir with the same name as the archive?
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.
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.