Skip to content

Instantly share code, notes, and snippets.

@framiere
Last active July 4, 2020 20:33
Show Gist options
  • Save framiere/97f2c8aee828b60b2eae1186ac9ee70b to your computer and use it in GitHub Desktop.
Save framiere/97f2c8aee828b60b2eae1186ac9ee70b to your computer and use it in GitHub Desktop.
for epub in $(ls *epub| grep -vE "\(\d+\)\.epub$") ; do
content=$(unzip -p $epub OEBPS/content.opf)
title=$(echo $content | xpath "(//dc:title/text())[1]")
identifier=$(echo $content | xpath "(//dc:identifier/text())[1]")
mv $epub "$title ($identifier).epub"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment