#!/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