![]() |
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-12 14:06 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Experts, please help look at this batch file for an undeletable folder |
| Printable Version 4,957 / 46 |
| Floor16 moniuming | Posted 2008-06-27 23:17 |
| 银牌会员 Posts 574 Credits 1,335 From 广西 | |
Originally posted by wingface at 2008-6-27 11:44: Impressive, you can even discover something like this, respect |
|
| Floor17 philon | Posted 2008-06-28 16:13 |
| 初级用户 Posts 19 Credits 42 | |
Originally posted by HAT at 2008-6-27 20:27: It can operate on it, but whether with copy or xcopy, it still can't copy folders into sm.!! So depressing~~ |
|
| Floor18 HAT | Posted 2008-06-28 16:18 |
| 版主 Posts 5,017 Credits 9,023 | |
Originally posted by philon at 2008-6-28 04:13 PM: I tested it, it works. Post your xcopy command so I can take a look. |
|
| Floor19 philon | Posted 2008-06-28 16:21 |
| 初级用户 Posts 19 Credits 42 | |
Originally posted by HAT at 2008-6-28 16:18: Brother hat, take a look: @echo off&mode con cols=50 lines=12 title Create or delete a private folder if not exist sm..\nul ( md sm..\ color 5a&cls&echo.&echo The private folder has been created! Files will be put into the private folder...&ping/n 2 127.1>nul echo Copying files... xcopy %CurDir% * sm6b7e~1>nul 2>nul ) else ( rd /s/q sm..\ color 5e&cls&echo.&echo The private folder has been deleted!&ping/n 2 127.1>nul ) color 5b&cls&echo.&echo Run it again to recreate or delete!&ping/n 2 127.1>nul |
|
| Floor20 HAT | Posted 2008-06-28 16:22 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Look more carefully at xcopy help ^_^
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T. |
|
| Floor21 philon | Posted 2008-06-28 16:27 |
| 初级用户 Posts 19 Credits 42 | |
|
xcopy %CurDir% * sm6b7e~1/e>nul 2>nul
xcopy %CurDir% * sm6b7e~1/s/e>nul 2>nul xcopy %CurDir% * sm6b7e~1/s/e/t>nul 2>nul None of the above work! |
|
| Floor22 HAT | Posted 2008-06-28 16:34 |
| 版主 Posts 5,017 Credits 9,023 | |
| Floor23 philon | Posted 2008-06-28 16:42 |
| 初级用户 Posts 19 Credits 42 | |
|
Of course, if I specify the absolute path of the source files, it can copy all files and folders, but what I want is for it to copy all files and folders in the current directory. Does xcopy not recognize %CurDir%?
|
|
| Floor24 philon | Posted 2008-06-28 16:51 |
| 初级用户 Posts 19 Credits 42 | |
|
Brother HAT, are you still here? Please explain.
|
|
| Floor25 HAT | Posted 2008-06-28 17:10 |
| 版主 Posts 5,017 Credits 9,023 | |
|
sm..\ is also in the current directory. You can't expect to copy a folder into itself, can you?
Cannot perform a cyclic copy |
|
| Floor26 philon | Posted 2008-06-28 17:20 |
| 初级用户 Posts 19 Credits 42 | |
|
That's true too. Looks like the requirement I raised at the beginning can't be achieved.
|
|
| Floor27 philon | Posted 2008-06-28 17:22 |
| 初级用户 Posts 19 Credits 42 | |
|
Actually, copying sm..\ itself is meaningless. So is there any way to copy all the other folders except sm..\ into sm..\?
If so, what statements need to be added? I still hope brother HAT can help me out. [ Last edited by philon on 2008-6-28 at 05:24 PM ] |
|
| Floor28 HAT | Posted 2008-06-28 17:28 |
| 版主 Posts 5,017 Credits 9,023 | |
|
xcopy only supports file exceptions, not folder exceptions. Think of some other way.
|
|
| Floor29 HAT | Posted 2008-06-28 17:34 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Add a fox loop to exclude sm..\, then use xcopy /i, maybe it can be done. Going to eat first, we'll discuss it again when I get back.
|
|
| Floor30 fastslz | Posted 2008-06-28 19:03 |
| 铂金会员 Posts 2,315 Credits 5,493 From 上海 | |
| Prev 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |