harsh vardhan Asked: 2018-08-27 19:21:41 +0800 CST2018-08-27 19:21:41 +0800 CST 2018-08-27 19:21:41 +0800 CST Changing first letter of a filename to uppercase 772 How can one change the first letter of a filename to uppercase using a command line? IS there any command line to do so? command-line filename 1 Answers Voted Olorin 2018-08-27T19:48:54+08:002018-08-27T19:48:54+08:00 Using the rename command: rename -n 's/./\U$&/' * -n only shows what changes will be made. After you verify the changes, run without -n to 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)
Using the
rename
command:-n
only shows what changes will be made. After you verify the changes, run without-n
to actually rename the files.s/./\U$&/
:s
ubstitutes the first character (.
) with the uppercase (\U
) of whatever was matched ($&
).Example: