2014-02-08 13:34:26 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] ; then
|
2014-11-12 16:15:39 +01:00
|
|
|
cat<<EOF
|
2014-02-08 13:34:26 +01:00
|
|
|
Usage: ${1##*/} FOLDERS
|
|
|
|
|
|
|
|
Rename to lowercase all files found in FOLDERS if destination does not exists.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2014-11-12 16:15:39 +01:00
|
|
|
exit
|
2014-02-08 13:34:26 +01:00
|
|
|
fi
|
|
|
|
|
2014-02-09 15:02:53 +01:00
|
|
|
if ! command -v renamelower >/dev/null 2>&1; then
|
2014-11-12 16:15:39 +01:00
|
|
|
echo "'renamelower' not found in PATH. Exiting." >&2
|
|
|
|
exit 1
|
2014-02-08 13:48:03 +01:00
|
|
|
fi
|
|
|
|
|
2014-02-09 15:02:53 +01:00
|
|
|
## Note: the -name check is not mandatory, but greatly improves the average
|
|
|
|
## performance.
|
2014-02-08 13:34:26 +01:00
|
|
|
for i ; do
|
2014-11-12 16:15:39 +01:00
|
|
|
find "$i" -depth -name '*[[:upper:]]*' -exec renamelower {} +
|
2014-02-08 13:34:26 +01:00
|
|
|
done
|