Rename batch of file in UNIX

后端 未结 2 449
无人及你
无人及你 2021-01-14 08:36

I have a set of file as follow :

  • oldname_1.txt
  • oldname_1.pdf
  • oldname_1.bak

etc.. with a different extension for each, I need

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 09:16

    One way to rename your files:

    for i in oldname*; do mv "$i" "${i/oldname/newname}"; done
    

提交回复
热议问题