====== Rename all folders and files to lowercase ====== A concise version using "rename" command. find my_root_dir -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \; This avoids problems with directories being renamed before files and trying to move files into non-existing directories (e.g. "A/A" into "a/a"). Or, a more verbose version without using "rename". for SRC in `find my_root_dir -depth` do DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'` if [ "${SRC}" != "${DST}" ] then [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" || echo "${SRC} was not renamed" fi done