]> git.phdru.name Git - dotfiles.git/blob - bin/cleanup-filenames-recursive.sh
Initial import
[dotfiles.git] / bin / cleanup-filenames-recursive.sh
1 #! /bin/sh
2
3 if ! echo "$LC_CTYPE" | grep -Fiq utf-8; then
4    echo "This script requires UTF-8 locale" 1>&2
5    exit 1
6 fi
7
8 if [ "$1" ]; then
9    cd -- "$1" || exit 1 # or just do it in current directory
10 fi
11 start_dir="`pwd`"
12
13 find . -depth -type d -print |
14 while read dir; do
15    cd -- "$dir" &&
16    cleanup-filenames.sh * &&
17    cd -- "$start_dir" || exit 1
18 done
19
20 [ "$1" ] && [ "$1" != . ] && exec cleanup-filenames.sh "$1"
21 exit 0