One liner to rename bunch of files

前端 未结 3 758
失恋的感觉
失恋的感觉 2021-01-02 04:32

I was looking for a linux command line one-liner to rename a bunch of files in one shot.

pattern1.a  pattern1.b pattern1.c ...

Once the com

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 05:00

    for i in pattern1.*; do mv -- "$i" "${i/pattern1/pattern2}"; done
    

    Before you run it, stick an echo in front of the mv to see what it would do.

提交回复
热议问题