Script to convert filenames to lowercase depending on extension

view story

http://unix.stackexchange.com – I've found this script, but I don't understand how it works. #!/bin/bash shopt -s nullglob for dir; do [[ -d $dir ]] || continue jpgs=( "${dir}"/*.jpg ) if (( "${#jpgs[@]}" )); then [[ -d ${dir}/Covers ]] || mkdir "${dir}/Covers" # Avoiding race condition by not reusing the jpgs array for jpg in "${dir}"/*.jpg; do mv "$jpg" "${dir}/Covers" done fi done I'm new to shell scripting. I want a script to convert filenames in a folder from uppercase to lowercase depending on the extension of the file. How can I do that? (HowTos)