wojteo wojteo - 5 months ago 21
Bash Question

How to change filenames to lowercase?

I need to change all names of all files in specific directory to lowercases, using bash script. Moreover I don't want to change names of subdirectories, as it was proposed in How to rename all folders and files to lowercase on Linux?

Answer
for file in *; do
    [[ -f "$file" ]] && mv "$file" "${file,,}" 2>/dev/null
done

I'm not sure what version of bash introduced the ${var,,} expansion.