wojteo wojteo - 1 year ago 138
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 Source
for file in *; do
    [[ -f "$file" ]] && mv "$file" "${file,,}" 2>/dev/null

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download