How to Re-Number the Files Sequentially on Windows using Batch P
- 时间:2020-09-18 17:26:09
- 分类:网络文摘
- 阅读:103 次
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) —
推荐阅读:十种常见食物搭配吃得营养又健康 日常食物怎样搭配吃出加倍营养? 秋冬季这样吃南瓜可防治便秘胃痛 三种豆子一起吃营养效果最好 红糖对女人健康有三大养生功效 南瓜的养生功效:温润脾胃护心助眠 可以用豆浆替代牛奶来补钙吗? 早餐吃鸡蛋7大好处及快速烹调法 把虾皮作为补钙佳品还需三思而行 饮食健康:保护肝脏必吃8种蔬菜
- 评论列表
-
- 添加评论