You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB
Bash

#!/usr/bin/env bash
for i in {1..500}
do
if [[ $i -lt 10 ]]
then
ficstring="00$i"
else
if [[ $i -lt 100 ]]
then
ficstring="0$i"
else
ficstring="$i"
fi
fi
if compgen -G "files/texts/${ficstring}.*" > /dev/null
then
if test -f "files/originalsmeta/${ficstring}.py"
then
if grep -q "^locked = True" "files/originalsmeta/${ficstring}.py"
then
builddir="secret"
else
if grep -q "^locked = False" "files/originalsmeta/${ficstring}.py"
then
builddir="files"
fi
fi
else
if test -f "files/translationsmeta/${ficstring}.py"
then
if grep -q "^locked = True" "files/translationsmeta/${ficstring}.py"
then
builddir="secret"
else
if grep -q "^locked = False" "files/translationsmeta/${ficstring}.py"
then
builddir="files"
fi
fi
else
builddir="null"
fi
fi
if [ ${builddir} != "null" ]
then
if test -f "files/texts/${ficstring}.html"
then
mv "files/texts/${ficstring}.html" "build/${builddir}/"
fi
if test -f "files/texts/${ficstring}.pdf"
then
mv "files/texts/${ficstring}.pdf" "build/${builddir}/"
fi
if test -f "files/texts/${ficstring}.epub"
then
mv "files/texts/${ficstring}.epub" "build/${builddir}/"
fi
fi
fi
done