Parent path is /opt/data/ and within data folder there are multiple subfolders and within those subfolders there are multiple files which I want to rename only some part of it using bash.Original file name:WK6LZTPR99999999_dig_2017-07-10 01:55:57.xywhich I want to change all files with in all sub directory as:WK6LZTPR99999999_cur_2017-07-10 01:55:57.mp3Hope I elaborate the scenario clearly. solution was given by philiphs work great but it is changing the other file extension as well in directories , I want to change only .xy file tension and other then that extension should be excluded.
File renaming using bash script
bash;rename
You can loop through all files with a for loop, then remove the suffix using ${variable%suffix} syntax and finally replace that middle part with the ${variable/search/replace} syntax:for file in /opt/data/*/*; do  file=${file%xy}  mv $filexy ${file/dig/cur}mp3done