Last active
February 28, 2023 06:19
-
-
Save bvaudour/48d972a045bc28767fab to your computer and use it in GitHub Desktop.
tar.lz4 creation/extraction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "Usage : $0 <file to compress>" | |
exit 1 | |
fi | |
file=${1%%/} | |
tar c "$file" | lz4 -z - "$file.tar.lz4" | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
with GNU tar, use option -I lz4
would be better.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lz4 -dc --no-sparse "$1" | tar xf -
lz4 -dc --no-sparse "$1" | tar x
last is the same ,ne need 'f -'