Skip to content

Instantly share code, notes, and snippets.

@bavardage
Created March 29, 2010 19:42
Show Gist options
  • Select an option

  • Save bavardage/348310 to your computer and use it in GitHub Desktop.

Select an option

Save bavardage/348310 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd $1
convertdir=`pwd`
cd "$convertdir"
mkdir results
echo "GO GO GO!"
for file in `ls *.epub`
do
tmpdir="/tmp/convert/convert-${file}/"
mkdir -p $tmpdir
cp $file $tmpdir
cd $tmpdir
echo "unzipping"
unzip $file
echo "unzipped"
rm $file
echo "removed"
echo "now in " `pwd`
zip -q0X ../$file mimetype
zip -qXr9D ../$file *
cp ../$file $convertdir/results/
cd $convertdir
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment