Skip to content

Instantly share code, notes, and snippets.

@LazerPanther
Created January 31, 2016 23:37
Show Gist options
  • Save LazerPanther/bd0a1360ce40071860a3 to your computer and use it in GitHub Desktop.
Save LazerPanther/bd0a1360ce40071860a3 to your computer and use it in GitHub Desktop.
A somewhat unnecessary script used to compress a folder into a 7zip archive with "ultra" settings.
#!/bin/sh +x
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "1 argument required, $# provided"
[ -e "$1" ] || die "$1 does not exist"
_cwd=`pwd`
_file=$( basename "$1" )
_ext=${_file##*.}
_shortname=$( basename "$_file" .$_ext )
_workdir=${_tmp}
echo "Compressing files..."
7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=64m -ms=on "${_shortname}.7z" "$_shortname/"
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment