Last active
December 12, 2022 14:20
-
-
Save SolomidHero/7ce47dd6db4b9488d87a17701bea23df to your computer and use it in GitHub Desktop.
Fast archiving/unarchiving
This file contains hidden or 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/sh | |
# archive: tar + pigz | |
tar -cf split.tar.gz -I pigz dir/ | |
# unarchive: tar + pigz | |
tar -xf split.tar.gz -I pigz -C ./ | |
# archive: zip | |
zip -rq -0 split2.zip split/ | |
# unarchive: unzip - fastest for <10k files | |
item=dir ; OUTDIR=$(dirname ${item}) && zipinfo -1 ${item}.zip | xargs -P8 -n30 unzip -qo ${item}.zip -d $OUTDIR | |
# unarchive: unzip (using glob) - fastest for many subfolders with many files | |
item=dir ; OUTDIR=$(dirname ${item}) && zipinfo -1 ${item}.zip | cut -d '/' -f1,2 | uniq | xargs -P8 -I{} unzip -quo ${item}.zip -d $OUTDIR "{}/*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment