If you want to change the directories and subdirectories only (i.e. leave the files alone), you should go with the find
command.
If you are using bash v. 4 or greater you can do it without invoking any other program but bash itself:
$ find . -mindepth 1 -depth -type d -execdir bash -c \
'mv -T "${0}" "${0,,}"' "{}" \;
(edited to add the -T
option, see comments).
Otherwise, you need to convert the directory name by other means, e.g. tr
:
$ find . -mindepth 1 -depth -type d -execdir bash -c \
'mv -T "$0" "$(echo $0 | tr [:upper:] [:lower:])"' "{}" \;
(edited to add double quotes around paths, as suggested in the comments)
Note that you must use -depth
in order to change the directory names in depth-first order (do not cut the branch you are sitting on).
Also, you need -execdir
instead of -exec
to rename just one path element at a time.