Well, if we can convert the first letter of each lines from a text file, we can use the same approach to convert the first letter of a directory or folder name to its uppercase as well, simply add the linux mv command.
If you have hundreds of directory name in one location that starts their directory folder name with small letters, and you with to rename directory where its first letter is in uppercase form, read on.
With reference to recent post, here is a short entry where you can convert all first letter of all directory folder names into its uppercase form.
How To Convert First Letter of Directory Folder To Its Uppercase Form
Taking a longer approach would be like creating an executable bash shell script like so
# cat rename-folder.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash
ls -la | grep dr | grep -v "\." | awk '{print $8}' | while read -r FOLDER
do
newfoldername=`echo $FOLDER | sed -e 's/\(.\)\(.*\)/\u\1\2/'`
echo OLD Name: [$FOLDER] TO NEW Name: [$newfoldername]
# You know what to do from this line -
# Rename the old to new
# using mv linux command
done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enjoy the weekend.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2008
(2301)
-
▼
March
(8)
- Shell: Shortcut To Last Command Line Argument
- HowTo: Motion Picture Linux Paint and Retouching Tool
- HowTo: Convert First Letter of Dir Folder to Upper...
- HowTo: Lightning Speed Big Claws
- HowTo: Convert First Letter of Text Line to Uppercase
- HowTo: Automatically Change your Fedora Desktop Wa...
- HowTo: Extremely Powerful Linux Password Sniffer
- HowTo: Recover Missing Portmap on Fedora 8
-
▼
March
(8)
Thursday, March 13, 2008
HowTo: Convert First Letter of Dir Folder to Uppercase
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment