Jan 26

#!/bin/bash
for x in `find * -maxdepth 0 -type d`;
do
  # Translate Caps to Small letters
  y=$(echo $x | tr ‘[A-Z]’ ‘[a-z]’);

  # check if directory exits
  if [ ! -d $y ]; then
     echo “mv $x $y”
     mv $x $y;
  fi
done

NOTE: -maxdepth 0 is for directories in curent dir. If you want to rename in depth use -depth instead

written by MG \\ tags: , , , ,