I want to rename all the files in a folder which starts with 123_xxx.txt
to xxx.txt
.
For example, my directory has:
123_xxx
Tried the answer above but it didn't work for me cause i had the string inside folders and files name at the same time so here is what i did the following bash script:
for fileType in d f
do
find -type $fileType -iname "stringToSearch*" |while read file
do
mv $file $( sed -r "s/stringToSearch/stringToReplaceWith/" <<< $file )
done
done
First i began by replacing inside folders name then inside files name.