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-08-12 12:29
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Does a full disk search include all folders? View 1,466 Replies 7
Original Poster Posted 2008-12-22 23:07 ·  中国 新疆 阿克苏地区 阿克苏市 电信
初级用户
Credits 34
Posts 15
Joined 2008-10-10 19:34
17-year member
UID 128019
Gender Male
From 四川
Status Offline
This is like this. I want to use DOS to clean up a certain file throughout the disk.
That is, I haven't figured out how to achieve quickly searching for this file throughout the disk, for example: autorun.inf
I all clean up like this,
del /f /q c:\autorun.inf
del /f /q d:\autorun.inf
del /f /q e:\autorun.inf
......
This is very rigid and not flexible. What if this file is not in the root directory of c, d, e...?
I have thought about it for a long time and haven't figured it out. I have repeatedly read DOS books and haven't found what I want.
Please help the expert to solve this problem. Then I can make the BAT for cleaning the file I want. I will write it and share it with you guys~~!
Floor 2 Posted 2008-12-23 09:42 ·  中国 河北 保定 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
for %i in (c d e f g h i j k ...) do del /f/q/s/a %i:\*.tmp
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2008-12-23 11:46 ·  中国 新疆 阿克苏地区 中移铁通
初级用户
Credits 34
Posts 15
Joined 2008-10-10 19:34
17-year member
UID 128019
Gender Male
From 四川
Status Offline
What I tested on the 2nd floor doesn't seem to work. What I want is the entire disk, including all folders. I remember I read an article like this. I only remember there is a command called attrib, and another command I can't remember, which can search the entire disk including all folders. I didn't save that article, and now I feel a bit regretful!
Floor 4 Posted 2008-12-23 13:19 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Go to the batch processing room to search for "full disk search"

Q: How to use the forum's search function to solve your own problems?
A: Reference: http://www.cn-dos.net/forum/viewthread.php?tid=44122#pid308085
Floor 5 Posted 2008-12-23 14:01 ·  中国 河北 保定 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
What I gave is a full-disk search, including subfolders. Note the /s parameter. The /a parameter just includes all hidden files.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 6 Posted 2010-03-16 08:39 ·  中国 广东 深圳 电信
新手上路
Credits 1
Posts 1
Joined 2010-03-15 17:34
16-year member
UID 162252
Gender Male
Status Offline
Learning
Floor 7 Posted 2010-03-16 17:08 ·  中国 福建 泉州 石狮市 电信
新手上路
Credits 15
Posts 14
Joined 2010-02-26 01:33
16-year member
UID 161204
Gender Male
Status Offline
@echo off
The following is to search and copy to D:\2

Please refer to it yourself. Thank you.


for %%? in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%i in ('dir %%?:\*.doc /s/b') do xcopy "%%i" d:\2\
set "ts=%%~dpa" & goto next
)
)
pause>nul | set/p=File does not exist. Please press any key to exit. . . & exit /b
Floor 8 Posted 2010-04-29 22:08 ·  中国 四川 内江 电信
新手上路
Credits 3
Posts 3
Joined 2010-04-19 20:51
16-year member
UID 164987
Gender Male
Status Offline
Forum Jump: