![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-11 13:05 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » How to add a duplicate-name check and rename files during a batch distribution process |
| Printable Version 684 / 0 |
| Floor1 lookinglovem | Posted 2009-03-11 12:03 |
| 新手上路 Posts 3 Credits 3 | |
|
cd /d "F:\test\"
for /f "delims=" %%a in ('dir /s /a-d /b E:\move\LVU-*.jpg') do ( for /f "delims=_" %%i in ("%%~na") do ( move /y "%%a" F:\tes ) ) How do I check here whether there is already a JPG file with the same name in the F:\test\ directory, and if there is, rename it before distributing it? For example: both F:\test\ and E:\move\ have LVU-001_1.jpg. After running it, the LVU-001_1.jpg in E:\move\ should be renamed to LVU-001_1(2).jpg and then distributed into the F:\test directory. In other words, after execution, F:\test\ should contain both the original LVU-001_1.jpg and the distributed LVU-001_1(2).jpg QuestionING |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |