![]() |
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-06 05:29 |
48,039 topics / 350,124 posts / today 2 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » How to create same-named folders for same-named files and copy them into the same-named folders? Solved |
| Printable Version 1,128 / 10 |
| Floor1 superadam | Posted 2007-10-16 20:16 |
| 初级用户 Posts 51 Credits 113 | |
|
Good evening, friends. I have a question for you:
For example, in a folder on drive C there are A-001.ppt, A-002.ppt, A-004.PPT....*.ppt How can I use a batch file to automatically create folders in the current directory named A-001, A-002, A-004....* and so on, matching the filenames, and then automatically copy A-001.ppt, A-002.ppt, A-004.PPT....*.ppt into the same-named folders? (For example: the newly created A-001 folder contains A-001.ppt) Thank you all for your replies! [ Last edited by superadam on 2007-10-16 at 09:29 PM ] |
|
| Floor2 superadam | Posted 2007-10-16 20:18 |
| 初级用户 Posts 51 Credits 113 | |
|
I just saw that moderator lxmxn is online, please help, I would be truly grateful!
[ Last edited by superadam on 2007-10-16 at 08:21 PM ] |
|
| Floor3 superadam | Posted 2007-10-16 20:41 |
| 初级用户 Posts 51 Credits 113 | |
|
All you DOS veterans, please help, I need it urgently, thank you.
|
|
| Floor4 lxmxn | Posted 2007-10-16 20:43 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Try this:
|
|
| Floor5 superadam | Posted 2007-10-16 20:59 |
| 初级用户 Posts 51 Credits 113 | |
|
First, thanks to moderator lxmxn. I'll try it first. Many thanks. Come visit my home sometime when you're free, hehe.
|
|
| Floor6 superadam | Posted 2007-10-16 21:04 |
| 初级用户 Posts 51 Credits 113 | |
Originally posted by lxmxn at 2007-10-16 08:43 PM: Amazing, thank you so much, it really works. Looks like I made the problem more complicated than it was. Thank you very, very much! |
|
| Floor7 superadam | Posted 2007-10-16 21:08 |
| 初级用户 Posts 51 Credits 113 | |
|
By the way, one more question: how should %%~dpna be explained? Please enlighten me, thanks!
It looks to me like a naming path, but I don't quite understand it. Please explain :) [ Last edited by superadam on 2007-10-16 at 09:11 PM ] |
|
| Floor8 lxmxn | Posted 2007-10-16 21:12 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Hehe, you're too polite.
Look at the last page of for help. |
|
| Floor9 superadam | Posted 2007-10-16 21:15 |
| 初级用户 Posts 51 Credits 113 | |
|
I'm not just being polite. I was rushing to prepare materials at work, and when I urgently needed this, you stepped in, so of course I'm extremely grateful. A timely help indeed.
Is it this: %~dpI - Expands %I to a drive letter and path only [ Last edited by superadam on 2007-10-16 at 09:17 PM ] |
|
| Floor10 lxmxn | Posted 2007-10-16 21:23 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Save this here as a batch file and run it:
|
|
| Floor11 superadam | Posted 2007-10-16 21:25 |
| 初级用户 Posts 51 Credits 113 | |
Originally posted by lxmxn at 2007-10-16 09:23 PM: |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |