Skip to content

Instantly share code, notes, and snippets.

@martin-magakian
Forked from bvaudour/compress.sh
Last active December 3, 2017 13:41
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 martin-magakian/55bd3218bd520db40f07230ff9440da5 to your computer and use it in GitHub Desktop.
Save martin-magakian/55bd3218bd520db40f07230ff9440da5 to your computer and use it in GitHub Desktop.
tar.lz4 creation/extraction
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage : $0 <file to compress>"
exit 1
fi
input=${1%%/}
output=$(PWD)/$(basename $input).tar.lz4
tar c "$input" | lz4 -z - "$output"
exit 0
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage : $0 <file to uncompress>"
exit 1
fi
if [[ "$1" == *.tar.lz4 ]]; then
lz4 -dc --no-sparse "$1" | tar xf -
#lz4 -d "$1"
#tarf=${1%.lz4}
#tar xvf "$tarf"
#rm "$tarf"
else
echo "$1 is not an archive tar.lz4"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment