batch rename files with ids intact

后端 未结 2 1291
独厮守ぢ
独厮守ぢ 2021-01-23 17:50

i have a directory listing like

seascaperecovered0088crop.jpg 
seascaperecovered0096crop.jpg
seascaperecovered0098crop.jpg
seascaperecovered0101crop.jpg
seascape         


        
2条回答
  •  清歌不尽
    2021-01-23 18:16

    Very straightforward:

    for i in seascaperecovered*.jpg; do A=${i/crop/}; mv $i ${A/recovered/_}; done
    

    (Put echo before the mv first for a dry run.)

提交回复
热议问题