I have created a list of files with names in uppercase alphabets and trying to rename them to files with the same names but in lowercase alphabets. So if i have 20 files with filenames like FILE1, FILE2, FILE3, etc. I want to rename them to file1, file2, file3, etc. respectively. I am executing the below command
[root@host-1-1 files]# find . -name 'FILE*' -exec mv {} `echo {} | tr [:upper:] [:lower:]` ;
But i am receiving below errors from mv command. Could someone please tell me what i am missing here?
mv: ‘./FILE1’ and ‘./FILE1’ are the same file
mv: ‘./FILE2’ and ‘./FILE2’ are the same file
mv: ‘./FILE3’ and ‘./FILE3’ are the same file
mv: ‘./FILE4’ and ‘./FILE4’ are the same file
mv: ‘./FILE5’ and ‘./FILE5’ are the same file
mv: ‘./FILE6’ and ‘./FILE6’ are the same file
mv: ‘./FILE7’ and ‘./FILE7’ are the same file
mv: ‘./FILE8’ and ‘./FILE8’ are the same file
mv: ‘./FILE9’ and ‘./FILE9’ are the same file
mv: ‘./FILE10’ and ‘./FILE10’ are the same file
mv: ‘./FILE11’ and ‘./FILE11’ are the same file
mv: ‘./FILE12’ and ‘./FILE12’ are the same file
mv: ‘./FILE13’ and ‘./FILE13’ are the same file
mv: ‘./FILE14’ and ‘./FILE14’ are the same file
mv: ‘./FILE16’ and ‘./FILE16’ are the same file
mv: ‘./FILE18’ and ‘./FILE18’ are the same file
mv: ‘./FILE20’ and ‘./FILE20’ are the same file
mv: ‘./FILE15’ and ‘./FILE15’ are the same file
mv: ‘./FILE17’ and ‘./FILE17’ are the same file
mv: ‘./FILE19’ and ‘./FILE19’ are the same file
[root@host-1-1 files]#
PS: I have already used for loop and have fulfilled my requirement. I am working on my understanding in find command.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…