Changing first letter of a filename to uppercase
5,221
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$&/
:s
ubstitutes 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)
Related videos on Youtube
![harsh vardhan](https://lh3.googleusercontent.com/-IOBi8jgk93o/AAAAAAAAAAI/AAAAAAAAAAA/APUIFaO0MI5z9rhORUHVBOzmpNQvi6Semg/mo/photo.jpg?sz=256)
Author by
harsh vardhan
Updated on September 18, 2022Comments
-
harsh vardhan almost 2 years
How can one change the first letter of a filename to uppercase using a command line?
IS there any command line to do so?