Skip to main content

Thread: CaSe changing command?


hello, may sound odd, know of command rename files , folders in directory lower case?

e.g.:

from

/folder/subfolder/case_sensitive/text.txt

to
/folder/subfolder/case_sensitive/text.txt

??

bash scripting! made , it's working fine
code:
#!/bin/bash parent_folder="/home/username/parent_folder" #path parent folder, edit whole script if [ ! -s "$parent_folder" ];  echo "parent folder not exist!\n"  exit 2; fi ifs_bak=$ifs ifs=" " file_or_folder in $(find "$parent_folder"/*);     file_or_folder_lowercase=$(echo $file_or_folder | tr '[a-z]' '[a-z]')     #sending error messages null because mv outputs error if filename same destination name     #as result, if have lowercase name not touch output error     mv "$file_or_folder" "$file_or_folder_lowercase" 2> /dev/null  done  ifs=$ifs_bak
although script *double* tested recommend backing up files before executing

edit: works if files have renamed(because if folder has been renamed , has subfiles 'mv' has wrong path.... working on it


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] CaSe changing command?


Ubuntu

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

2.5.28 to 3.4.1---Download of update package failed - Joomla! Forum - community, help and support

Your host needs to use PHP 5.3.10 or higher to run this vers - Joomla! Forum - community, help and support