Created
October 9, 2019 12:05
-
-
Save tnymlr/6413a2f8aeb95af639bad5bc43649011 to your computer and use it in GitHub Desktop.
Repack bunch of epubs to, it seems to be fixing their mime type
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
while read file; do \ | |
unzip "$file" -d "${file%.*}" && \ | |
pushd "${file%.*}" && \ | |
zip -X "${file%.*}_fixed.epub" mimetype && \ | |
zip -rg "${file%.*}_fixed.epub" META-INF && \ | |
zip -vur "${file%.*}_fixed.epub" * && \ | |
popd && mv "${file%.*}/${file%.*}_fixed.epub" ./ && \ | |
rm -rf "${file%.*}"; \ | |
done < <(find . -name '*.epub' | xargs -i basename "{}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment