Rename multiple files based on pattern in Unix

前端 未结 22 926
死守一世寂寞
死守一世寂寞 2020-11-22 06:31

There are multiple files in a directory that begin with prefix fgh, for example:

fghfilea
fghfileb
fghfilec

I want to rename a

22条回答
  •  情话喂你
    2020-11-22 07:10

    rename might not be in every system. so if you don't have it, use the shell this example in bash shell

    for f in fgh*; do mv "$f" "${f/fgh/xxx}";done
    

提交回复
热议问题