Sunday, April 29, 2012

Renaming small characters file name to capital letters

Let say you have a small letters filename for a file. And you prefer to convert all of them to capital letters, here goes;

We create several mock files using "touch" command.

najmi@vostro-mint:~/test$ touch aaa bbb ccc

najmi@vostro-mint:~/test$ ls
aaa  bbb  ccc




Use "for" loop as this makes you lazy:

With "verbose" command you should be able to see the output progress:

najmi@vostro-mint:~/test$ for i in *;do mv -v $i `ls $i|tr [a-z] [A-Z]`;done
`aaa' -> `AAA'
`bbb' -> `BBB'
`ccc' -> `CCC'

Done. That's all :)

No comments: