Created
November 4, 2019 02:54
-
-
Save chrismanahan/2bc1ab1331c8763303ad95e754061527 to your computer and use it in GitHub Desktop.
convert books to mobis
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 | |
# quick script to convert books to .mobi and put in a designated dir called mobi/ | |
for d in */; do | |
if [[ $d == "mobis" ]]; then continue; fi | |
cd "$d" | |
mobi=$(ls | grep 'mobi$') | |
epub=$(ls | grep 'epub$') | |
pdf=$(ls | grep 'pdf$') | |
if [[ -n $mobi ]]; then | |
echo "copying mobi" | |
cp "$mobi" ../mobis/ | |
elif [[ -n $epub ]]; then | |
echo "convert epub" | |
name=${epub%.*}.mobi | |
ebook-convert "$epub" "../mobis/$name" | |
elif [[ -n $pdf ]]; then | |
echo "convert pdf" | |
name=${pdf%.*}.mobi | |
ebook-convert "$pdf" "../mobis/$name" | |
fi | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment