User Tools

Source

find . -depth -type d -print0 | xargs -0 rename '$_ = uc $_'
find . -depth -type f -print0 | xargs -0 rename '$_ = uc $_'

This solution is not working fine so the next one is working better

#! /bin/bash
rename_item() {
  if [[ $1 != $2 ]]; then
    mv $i $2;
  fi
}
crawl() {
  for i in *; do
    new=$(echo $i | tr 'a-z' 'A-Z');
    if [[ -f $i ]]; then
      rename_item $i $new
    fi
    if [[ -d $i ]]; then
      rename_item $i $new
      cd $new
      crawl
      cd ..
    fi
  done
}
crawl

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information