ambevar-dotfiles/.scripts/renamelowerrec

24 lines
485 B
Plaintext
Raw Normal View History

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