]> git.phdru.name Git - dotfiles.git/blob - bin/cleanup-recode.sh
Initial import
[dotfiles.git] / bin / cleanup-recode.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 from_enc=utf-8
9 to_enc=koi8-r
10
11 while getopts f:t: opt; do
12    case $opt in
13       f ) from_enc="$OPTARG" ;;
14       t ) to_enc="$OPTARG" ;;
15    esac
16 done
17 shift `expr $OPTIND - 1`
18
19 for dir in "$@"; do
20    cleanup-filenames-recursive.sh "$dir" &&
21    recode-filenames-recursive.py "$from_enc" "$to_enc" "$dir" || exit 1
22 done