#! /bin/sh if ! echo "$LC_CTYPE" | grep -Fiq utf-8; then echo "This script requires UTF-8 locale" 1>&2 exit 1 fi if [ "$1" ]; then cd -- "$1" || exit 1 # or just do it in current directory fi start_dir="`pwd`" find . -depth -type d -print | while read dir; do cd -- "$dir" && cleanup-filenames.sh * && cd -- "$start_dir" || exit 1 done [ "$1" ] && [ "$1" != . ] && exec cleanup-filenames.sh "$1" exit 0