中国DOS联盟论坛

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-07 16:26
48,041 topics / 350,128 posts / today 3 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » How to batch delete malformed folders?
Printable Version  3,217 / 16
Floor1 5872169 Posted 2008-02-29 17:58
高级用户 Posts 474 Credits 959
I downloaded a program and created 50 deformed folders on my desktop. The folder names are 1., 2.,... 50. How to batch delete them with a batch script? Please expert write a code!

[ Last edited by 5872169 on 2008-2-29 at 06:18 PM ]
Floor2 HAT Posted 2008-02-29 18:18
版主 Posts 5,017 Credits 9,023
Delete folders ending with a dot:

rd /a /q "1..\"
Floor3 5872169 Posted 2008-02-29 18:19
高级用户 Posts 474 Credits 959
Can I delete in batches? I'm tired of deleting one by one. I know this code. I only know that I can delete with the FOR command, but I don't know how to write it!
Floor4 NeverAgain Posted 2008-02-29 18:52
初级用户 Posts 40 Credits 67
for /l %%a in (0 1 9) do (
for /l %%b in (0 1 9) do (
rd /q /s "%%a%%b..\" 2>nul
))
Floor5 5872169 Posted 2008-02-29 18:57
高级用户 Posts 474 Credits 959
The code on floor 4 doesn't work, can't delete it. Why is there no path! My folder name is 1. Not 01.!

[ Last edited by 5872169 on 2008-2-29 at 07:02 PM ]
Floor6 leman Posted 2008-02-29 19:08
新手上路 Posts 2 Credits 6
@echo off
rmdir c:\%systemdrive%\Documents and Settings\用户名\桌面\1...\ /s
pause
Floor7 5872169 Posted 2008-02-29 19:09
高级用户 Posts 474 Credits 959
I have more than one folder, there are too many, it's too troublesome to delete one by one! I want to use the FOR command to delete, but I don't know how to write it!
Floor8 dikex Posted 2008-02-29 19:10
高级用户 Posts 366 Credits 788
```
@echo off

:DELF
if == goto :EOF
rd /s /q %1.\
shift
goto :DELF
```
Floor9 5872169 Posted 2008-02-29 19:14
高级用户 Posts 474 Credits 959
The code on the 8th floor doesn't work either!
Floor10 NeverAgain Posted 2008-02-29 19:20
初级用户 Posts 40 Credits 67
If you are using the Chinese version of Windows:
Floor11 5872169 Posted 2008-02-29 19:24
高级用户 Posts 474 Credits 959
The code on the 10th floor doesn't work either!
Floor12 dikex Posted 2008-02-29 19:26
高级用户 Posts 366 Credits 788
Originally posted by 5872169 at 2008-2-29 07:14 PM:
The code on floor 8 doesn't work either!


Is it prompting for access denied...

Just did an experiment, Windows has a limit on the maximum length of supported parameters. For folders on the desktop, probably at most 40 can be deleted simultaneously...

P.S. The %%b on floor 10 shouldn't be there
Floor13 NeverAgain Posted 2008-02-29 19:28
初级用户 Posts 40 Credits 67
There is a %%b added above, make a small change:


[ Last edited by NeverAgain on 2008-2-29 at 07:29 PM ]
Floor14 5872169 Posted 2008-02-29 19:32
高级用户 Posts 474 Credits 959
Thanks a lot! It succeeded at the 13th floor! All deleted, and learned something again!
Floor15 plp626 Posted 2008-02-29 20:13
银牌会员 Posts 1,020 Credits 2,278
Do not run under the path where the ghost backup file is located!




-----------------------------------------------------------------

Delete empty abnormal directories in the directory tree and display non-empty abnormal directories


[ Last edited by plp626 on 2008-2-29 at 08:57 PM ]
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023