Linux – Rename files in subdirectories

bashbatch-renamelinuxrenameshell

I want to rename some files "folder.jpg" to "cover.jpg". The files itself are located two levels below of the current directory. A simple call

mv */*/folder.jpg */*/cover.jpg

does not work.

So…how can this be done automatically for all subdirectories?

Thanks!

Best Answer

You can use find for this:

find ./your-top-dir/ -iname 'folder.jpg' -execdir mv -i '{}' cover.jpg \;
Related Question