Skip to content

Instantly share code, notes, and snippets.

@hugows
Last active December 2, 2019 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugows/b0e8be2c9a2fede12b65bd8abf9a3983 to your computer and use it in GitHub Desktop.
Save hugows/b0e8be2c9a2fede12b65bd8abf9a3983 to your computer and use it in GitHub Desktop.
nemo file manager - set it to open zip files with this script by default = quick way to handle zip files
#!/usr/bin/bash
parentdir=$(dirname "$@")
cd $parentdir
if [[ $@ == *.zip ]]; then
outputdir=$(basename "$@" ".zip")
fi
if [[ $@ == *.rar ]]; then
outputdir=$(basename "$@" ".rar")
fi
if [[ $@ == *.tar.gz ]]; then
outputdir=$(basename "$@" ".tar.gz")
fi
if [[ -v outputdir ]]; then
if 7z x "$@" -o"$outputdir"; then
rm -f "$@"
fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment