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-20 05:23
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Find Files and Operate (View Path, Copy, Delete).bat (9.5 Update) View 7,685 Replies 23
Floor 16 Posted 2006-09-03 01:38 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Originally posted by namejm at 2006-9-1 22:09:


  You still missed a very important file: fc_name.txt. If you miss this file, it will be a big problem - if you query different files several times and then directly choose to delete, uh...
I don't understand. I created this folder just to know later which files I have searched, copied, and deleted. It has nothing to do with deletion.
Floor 17 Posted 2006-09-03 13:21 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Because in your code, the for statement parses the text line by line. So, if you use the code in to filter records in the specified directory, how many lines are there in your %dati%_9.txt, the find %dati%_6.txt /v /i "%%a">>%dati%_5.txt statement will be executed that many times. You should change to another filtering solution to fundamentally solve the problem.

Just now during the testing process, it was found that in the option of not searching certain specific paths under the advanced search, you can only select y, but not n. Selecting n prompts that it is an invalid operation. This is because you did not make a jump when selecting n; after the selection is completed, a lot of temporary files have been generated before pressing any key to execute the next step. This belongs to the operation being too early, and it should start generating only after pressing any key; and after the search is completed, the path name in the success prompt is wrong;

Today I will temporarily test here. I will test comprehensively another day - the code is getting more and more, and it looks a bit difficult, especially when encountering unclear expressions. Please pay attention to modifying the prompt language to make it both concise and accurate, and not let others have misunderstandings.

for /f "tokens=* delims= " %%a in (%dati%_9.txt) do (find %dati%_6.txt /v /i "%%a">>%dati%_5.txt)
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 18 Posted 2006-09-04 08:05 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Originally posted by namejm at 2006-9-3 13:21:
Because in your code, the for statement parses the text line by line, so if you use the code in to filter the records of the specified directory, then how many lines are there in your %dati%_9.txt, find %dati%_6.txt /v ...

I'm also thinking of other methods to solve this, but I haven't thought of it yet
Floor 19 Posted 2006-09-08 00:55 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Originally posted by he200377 at 2006-9-4 08:05:

I'm also thinking of other ways to solve this, but I haven't come up with one yet

  In fact, after changing the filtering scheme, a few lines of concise code can solve the problem.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 20 Posted 2006-09-08 04:45 ·  中国 甘肃 张掖 临泽县 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Originally posted by namejm at 2006-9-8 00:55:

In fact, after changing the filtering scheme, a few lines of concise code can solve the problem.

Hehe, no matter how I change it, I find that the search speed during testing is not faster than the one built into Windows. I really don't know how Windows implements the search.
Floor 21 Posted 2006-09-08 04:52 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
That's because you used several for statements to read the content of the text. You know, the for statement parses the text as a whole. A large number of for operations will of course lead to low efficiency. Changing to a filtering solution can greatly improve the search efficiency.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 22 Posted 2006-09-08 05:19 ·  中国 湖北 孝感 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Originally posted by namejm at 2006-9-8 04:52:
????????????????????????????????????for?????????????????????????????????????????????for???????????????????????????????????????????????????for?????????????????????????????????????????????????????????...

What about the win... What specific problem are you having?
Floor 23 Posted 2006-11-23 15:23 ·  中国 北京 鹏博士BGP
初级用户
Credits 114
Posts 47
Joined 2006-11-20 04:17
19-year member
UID 71105
Gender Male
Status Offline
Learning
Floor 24 Posted 2006-11-23 21:38 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
I was too busy yesterday and didn't realize there were so many good posts.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Forum Jump: