batch rename multiple files across multiple folders in centos

30 Views Asked by At

This should be simple but can't figure it out:

Original file and folder structure

folder1/folderA1/folderA2/folderA3/OLDfile.jpeg
folder1/folderB1/folderB2/folderB3/OLDfile.exr

I would like to rename it to:

folder1/folderA1/folderA2/folderA3/NEWfile.jpeg
folder1/folderB1/folderB2/folderB3/NEWfile.exr

I have tried the rename command which works when directly changing the name inside the folder but cant get it to work with sub-directories across multiple files.

1

There are 1 best solutions below

0
spoax On

I found this worked for me:

find . -depth -iname "*OLD*" -exec rename OLD NEW '{}' \;