linux 批量重命名 所有子文件为序号

直接在目录下执行:

i=1; for x in *; do mv $x $i.png; let i=i+1; done

如果是windows,在git bash下执行也是可以的。

 

如果原保留原文件后缀名,可这样写:

i=1; for x in *; do mv $x $i.${x##*.}; let i=i+1; done

提取文件名或目录名可参考:
https://blog.csdn.net/liuyuedechuchu/article/details/123778605

posted @ 2022-08-02 09:38  流失的痕迹  阅读(286)  评论(0编辑  收藏  举报