Skip to content

Instantly share code, notes, and snippets.

@tnymlr
Created October 9, 2019 12:05
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 tnymlr/6413a2f8aeb95af639bad5bc43649011 to your computer and use it in GitHub Desktop.
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
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