How to Re-Number the Files Sequentially on Windows using Batch P
- 时间:2020-09-18 17:26:09
- 分类:网络文摘
- 阅读:98 次
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) —
推荐阅读:奥数题:一列火车匀速速度向北缓缓驶去 奥数题:小胖和小丁丁骑自行车从一条公路的两端同时出发相向而行 数学题:实际的工作效率是原计划的百分之125 数学题:将圆柱体加工成体积最大的长方体 奥数题:剩下的五盒重量是原来两盒的重量 永恒的坚守作文1200字 情人节礼物 微笑送给你我她(他)——读文章《感谢近视》有感450字 聪明的公鸡作文150字 狂欢是一群人的寂寞,独处是一个人的狂欢
- 评论列表
-
- 添加评论