Generalize convertcd.sh