How to Re-Number the Files Sequentially on Windows using Batch P
- 时间:2020-09-18 17:26:09
- 分类:网络文摘
- 阅读:113 次
You probably have a list of files e.g. camera pictures that you want to re-number sequentially. For example, the photos are named using dates-and-time string.

image-list-with-dates
However, this is not idea, as many of us want to re-name the files sequentially and possibly with a prefix.

images-re-numbered
Using the batch script below, we can easily rename all files in the same folder sequentially.
1 2 3 4 5 6 7 8 9 10 11 | @echo off REM rename-tool.cmd setlocal enabledelayedexpansion set num=1 for %%f in (*.%2) do ( ren "%%f" "%1!num!.%2" rem increment the numbering set /a num=!num!+1 ) endlocal |
@echo off REM rename-tool.cmd setlocal enabledelayedexpansion set num=1 for %%f in (*.%2) do ( ren "%%f" "%1!num!.%2" rem increment the numbering set /a num=!num!+1 ) endlocal
Example usage:
1 | rename-tool myfiles- jpg |
rename-tool myfiles- jpg
The first parameter is the prefix, and the second parameter the file suffix (extension). The above batch script may fail to rename some files if the target file exists, thus it is better to choose a different prefix when first time renaming all the files in the folder.
–EOF (The Ultimate Computing & Technology Blog) —
推荐阅读:手机网站在建设中 能够提升利用率的一些要点 做什么网站赚钱?游戏类网站可以考虑 官方回应国内版n号房调查:严厉追究法律责任! 分付,不是微信版“花呗”! 可往湖北寄快递了!湖北快递全面恢复! Freenom免费域名申请与DNS解析设置,可申请.tk.ml等域名 Heroku免费云空间512M内存可绑定域名 Freehostia免费虚拟主机提供免费空间大小1GB月流量6GB Awardspace免费php空间稳定可绑域名没有广告500MB空间 一站式商旅及费用管理平台“汇联易”完成3亿元C+轮融资
- 评论列表
-
- 添加评论