linux中实现对文件批量重命名
作者:互联网
1、
root@PC1:/home/test# ls root@PC1:/home/test# touch {a..d}.txt {a..d}.csv root@PC1:/home/test# ls a.csv a.txt b.csv b.txt c.csv c.txt d.csv d.txt root@PC1:/home/test# ls *.txt a.txt b.txt c.txt d.txt root@PC1:/home/test# ls *.txt | awk 'BEGIN{tag = 1} {printf("mv %s name%02d.png\n", $0, tag); tag++}' mv a.txt name01.png mv b.txt name02.png mv c.txt name03.png mv d.txt name04.png root@PC1:/home/test# ls *.txt | awk 'BEGIN{tag = 1} {printf("mv %s name%02d.png\n", $0, tag); tag++}' | bash root@PC1:/home/test# ls a.csv b.csv c.csv d.csv name01.png name02.png name03.png name04.png
标签:重命名,文件批量,PC1,linux,test,home,txt,csv,png 来源: https://www.cnblogs.com/liujiaxin2018/p/16212309.html