How can one change the first letter of a filename to uppercase using a command line?
IS there any command line to do so?
Asked
Active
Viewed 7,743 times
14
Zanna
- 72,312
harsh vardhan
- 141
1 Answers
26
Using the rename command:
rename -n 's/./\U$&/' *
-nonly shows what changes will be made. After you verify the changes, run without-nto actually rename the files.s/./\U$&/:substitutes the first character (.) with the uppercase (\U) of whatever was matched ($&).
Example:
$ ls
bar foo
$ rename -n 's/./\U$&/' *
rename(bar, Bar)
rename(foo, Foo)
Olorin
- 3,548