papers-we-love_papers-we-love/.scripts/cleanup.sh
2014-03-04 23:23:53 -05:00

16 lines
351 B
Bash
Executable File

#! /bin/bash
find -E . -regex '.*(pdf)$' -type f | while read f
do
p="$(basename "$f")"
dir="$(dirname "$f")"
lc=$(echo ${p} | tr '[:upper:]' '[:lower:]' \
| tr '_' '-' | tr -d ':' | tr -d ',' | tr '[:blank:]' '-' \
| sed 's/\-\-*/-/')
if [ "$p" != "$lc" ]
then
git mv -f "$dir/$p" "$dir/$lc"
fi
done