Skip to navigation
Bash script to rename all folders to lowercase on a File system what is not Case sensitive
18.07.25
Script what renames all folders to lowercase on a File system what is not Case sensitive. For example, you have a Windows flavor share what is not Case senitive mounted on a linux box. Now from the Linux box you try to rename the folders via your typical rename Linux command, what will not work. This script needs to be run multiple times to cover all recursive levels of folders ```bash #!/bin/bash find . -type d -print | while read d; do if [ "$d" != "." ]; then lower_str=$(echo "$str" | tr '[:upper:]' '[:lower:]') echo $d if [[ "${d}" =~ [A-Z] ]]; then echo "has upper" echo "...move ${d} to ${d}__ " mv "${d}" "${d,,}__" mv "${d,,}__" "${d,,}" else echo "...no more uppercase" fi fi done ```
https://www.baeldung.com/linux/bash-check-uppercase-letter-string
Reply
Anonymous
Information Epoch 1772319395
Live free or die.
Home
Notebook
Contact us