Rename file prefix using Shell Script


Let's say if we have multiple files with prefix as funiedb.alert.zip and what to change it as preprod.alert.zip. A single file can be renamed easily but if we have multiple files then we can use the below script to make our life easy.


Script:

for name in funiedb*
do
    newname=preprod"$(echo "$name" |  cut -c8- )"
    mv "$name" "$newname"
done




If you like please follow and comment