Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 14 lines (12 sloc) 0.441 kB
#!/bin/bash
# replace spaces with underscores, delete puncutation,
# change upper to lower case, remove extra underscores
find "$1" -depth | while read line; do
dir="$(dirname "$line")"
old="$(basename "$line")"
new="$(echo $old | tr ' ' '_' \
| tr -d '()[]{},?!' | tr -d "'" \
| tr '[[:upper:]]' '[[:lower:]]' \
| sed 's/__/_/g' | sed 's/_-_/-/g' )"
[[ "$old" != "$new" ]] && mv -iv "$dir/$old" "$dir/$new"
done
Jump to Line
Something went wrong with that request. Please try again.