In the GNU/Linux world, it is common to use lowercase characters to identify files and directories, to illustrate the above we show the DIRs that are found under the /etc/apache2 DIR on Debian GNU/Linux
/etc/apache2/ ├── conf-available ├── conf-enabled ├── mods-available ├── mods-enabled ├── sites-available └── sites-enabled
so if you have one or several DIRs in uppercase or lowercase and uppercase at the same time and for uniformity want to all be lowercase then you can rely on the following script.
#!/usr/bin/env bash
# GNU shell script para renombrar a minúscula ficheros y
# directorios
# ---------------------------------------------------------------
# Copyright (c) 2009 flossblog <http://flossblog.wordpress.com/>
# Este script es liberado bajos los téminos de la GNU GPL
# version 2.0 o superior
# --------------------------------------------------------------
# Uso:
# El script recibe como parámetro el nombre un fichero o
# directorio, para un directorio la operación se hará de
# forma recursiva
# -------------------------------------------------------------
# Última actualización: 10 de junio del 2009
find "$1" -depth -print0 | while read -d $'\0' file; do
NEWBASENAME=$(basename "$file" | tr [:upper:] [:lower:])
NEWFILENAME=$(dirname "$file")/$NEWBASENAME
mv -f "$file" "$NEWFILENAME" 2> /dev/null
done
To use the script download here
Set execute permissions
chmod a+x tolower.sh
Run the script
./tolower.sh nombre-del-fichero
Further readings
- man find
- man tr