19 lines
494 B
Bash
19 lines
494 B
Bash
# -*- mode: shell-script; -*-
|
|
|
|
# Makes all files in <directory> lower case. Works with Non-ASCII characters.
|
|
# Equivalent to `zmv "${dir}/(*)" '${dir}/${1:l}'`
|
|
function mksmol()
|
|
{
|
|
if [[ ${ARGC} -ne 1 ]]; then
|
|
print -u 2 "Usage: ${0} <directory>" >&2
|
|
return 1
|
|
fi
|
|
local dir="${1}"
|
|
|
|
for file in "${dir}"/*; do
|
|
basename="${file##*/}"
|
|
newfile="${dir}/${basename:l}"
|
|
[[ "${file}" != "${newfile}" ]] && mv "${file}" "${newfile}" || :
|
|
done
|
|
}
|