public
Authored by
doekia
action4diacritic.sh
Rename files with diacritics in filename
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Usage: find <folder> -name '*.jpg' -exec ./action4diacritic.sh [ | bash ]
#
# Could be quickly identified by
# find <folder> -name '*jpg' | tee u |iconv -f UTF-8 -t ISO8859-1 | tee l | iconv -f ISO8859-1 -t UTF-8 >/dev/null
#
i=$1
n=$(echo $1 | \
sed \
-e 's/À/À/g' \
-e 's/Á/Á/g' \
-e 's/Â/Â/g' \
-e 's/Ã/Ã/g' \
-e 's/Ä/Ä/g' \
-e 's/Å/Å/g' \
-e 's/à/à/g' \
-e 's/á/á/g' \
-e 's/â/â/g' \
-e 's/ã/ã/g' \
-e 's/ä/ä/g' \
-e 's/å/å/g' \
-e 's/Ç/Ç/g' \
-e 's/ç/ç/g' \
-e 's/È/È/g' \
-e 's/É/É/g' \
-e 's/Ê/Ê/g' \
-e 's/Ë/Ë/g' \
-e 's/è/è/g' \
-e 's/é/é/g' \
-e 's/ê/ê/g' \
-e 's/ë/ë/g' \
-e 's/Ì/Ì/g' \
-e 's/Í/Í/g' \
-e 's/Î/Î/g' \
-e 's/Ï/Ï/g' \
-e 's/ì/ì/g' \
-e 's/í/í/g' \
-e 's/î/î/g' \
-e 's/ĩ/ï/g' \
-e 's/Ñ/Ñ/g' \
-e 's/ñ/ñ/g' \
-e 's/Ò/Ò/g' \
-e 's/Ó/Ó/g' \
-e 's/Ô/Ô/g' \
-e 's/Õ/Õ/g' \
-e 's/Ö/Ö/g' \
-e 's/ò/ò/g' \
-e 's/ó/ó/g' \
-e 's/ô/ô/g' \
-e 's/õ/õ/g' \
-e 's/ö/ö/g' \
-e 's/Ù/Ù/g' \
-e 's/Ú/Ú/g' \
-e 's/Û/Û/g' \
-e 's/Ü/Ü/g' \
-e 's/ù/ù/g' \
-e 's/ú/ú/g' \
-e 's/û/û/g' \
-e 's/ü/ü/g' \
-e 's/Ý/Ý/g' \
-e 's/Ÿ/Ÿ/g' \
-e 's/ý/ý/g' \
-e 's/ÿ/ÿ/g' \
)
if [ "$i" != "$n" ]; then
echo mv $i $n
fi
Please register or sign in to comment