Changing first letter of a filename to uppercase
Solution 1:
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)