China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-26 06:27
中国DOS联盟论坛 » 其它操作系统综合讨论区 » Delete empty folders View 2,018 Replies 4
Original Poster Posted 2009-01-24 21:10 ·  中国 广东 电信
初级用户
Credits 23
Posts 8
Joined 2008-04-26 23:26
18-year member
UID 117059
Gender Male
From 四川
Status Offline
I'm a newbie, and I'd like to ask all you veterans for some advice. I do maintenance work, and because of the viruses on the company computers, I want to delete all files under d:\downloads\
My batch file is written like this:
del d:\Downloads\*.* /s /f /q
Next I want to delete all the empty folders under downloads\
How should I write it? I'd like to ask you all. Thanks.
Floor 2 Posted 2009-01-25 00:59 ·  中国 山东 青岛 阿里云
版主
★★★
操作系统爱好者
Credits 1,113
Posts 392
Joined 2002-11-11 00:00
23-year member
UID 228
Gender Male
Status Offline
About deletion under CMD, what you really should pay attention to is,
1, there is no DELTREE command anymore, so you need to use DEL together with RD.
2, you need to check whether the directory exists before executing, to avoid deleting the wrong thing
3, you can't delete a non-current directory, for example RD D:\ABC\EFG, this works in pure DOS and 98, but not in 2000/XP, you have to CD D:\ABC first and then delete EFG under the current directory.

[ Last edited by gmy on 2009-1-25 at 01:02 ]
DOS之家 http://doshome.com 站长 葛明阳
Floor 3 Posted 2009-01-25 10:46 ·  中国 安徽 黄山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
The third point is inaccurate. Under XP I haven't found any problem at all deleting a directory on a non-current drive.
Windows 一键还原
http://www.yjhy.com
Floor 4 Posted 2009-02-03 05:58 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
rd /s /q
Delete the folder and the files together.
Floor 5 Posted 2010-06-22 16:27 ·  中国 上海 电信
新手上路
Credits 16
Posts 17
Joined 2008-04-08 14:54
18-year member
UID 115249
Gender Male
Status Offline
Forum Jump: