中国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-29 08:05
47,816 topics / 349,916 posts / today 0 new / 48,265 members
DOS批处理 & 脚本技术(批处理室) » (Closed) A question about deleting files with the same size and type!
Printable Version  4,070 / 25
Floor1 WinXYhappy Posted 2006-10-26 05:25
初级用户 Posts 14 Credits 30
For example: If there are the following files under a folder (the folder name is known as asd, and there are many files in the folder, which cannot be listed manually):

Volume in drive D is WINDOWS
Volume Serial Number is E42C-4D75

Directory of D:\asd\asd

2006-10-24 17:47 <DIR> ..
2006-10-24 17:47 <DIR> .
2006-10-20 11:47 1,226 tftp.txt
2006-10-16 15:51 2,306 ftp1 server.txt
2006-10-16 15:51 2,306 ftp1.txt
2006-10-16 15:51 2,306 ftp2.txt
2006-10-16 15:51 2,306 ftp3.txt
2006-10-16 15:51 2,306 ftp1.rar
2006-10-16 15:51 2,306 ftp1.log
2006-10-16 15:51 2,306 ftp2 server.txt
2006-10-20 14:30 10,752 ftp1.doc
9 File(s) 28,120 bytes
2 Dir(s) 12,679,954,432 bytes free

How to delete files with the same size and the same file type???
(That is to say, the three files ftp2.txt, ftp3.txt, and ftp2 server.txt need to be deleted,)

[ Last edited by WinXYhappy on 2006-10-27 at 05:23 AM ]
Floor2 vkill Posted 2006-10-26 07:58
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
I remember there was a small thing that could be directly deleted, est posted about it
Floor3 lxmxn Posted 2006-10-26 09:05
版主 Posts 4,938 Credits 11,386

Are you going to delete all files with the same size and type, or keep one and delete the others?
Floor4 electronixtar Posted 2006-10-26 10:13
铂金会员 Posts 2,672 Credits 7,493
```
for /f "delims=" %a in ('dir /a ^| find "2,306"') do @del %a
```
Floor5 WinXYhappy Posted 2006-10-26 20:16
初级用户 Posts 14 Credits 30
Originally posted by lxmxn at 2006-10-26 09:05 AM:

The owner wants to delete all files with the same size and type, or keep one and delete the others?


Keep one. Delete other files that have the same size "and" also the same type as this one.
Floor6 不得不爱 Posted 2006-10-26 20:29
超级版主 Posts 2,044 Credits 5,310 From 四川南充
What the 4th floor provided does not meet the requirements
Floor7 WinXYhappy Posted 2006-10-26 20:39
初级用户 Posts 14 Credits 30
Originally posted by electronixtar at 2006-10-26 10:13 AM:


After confirming it is correct, change echo %a to del %a


What I mean is: First, we don't know how many files are in the folder (because there are too many to list manually), and we don't know the size of the files. We only know the name and path of the folder. The above is a simple example. Actually, there are many files (mainly.doc,.xls files, too many to list here), and there are many files with similar names and the same size that are actually the same. So we need to delete them to save space.
Hope electronixtar can help improve it again. By the way, can batch processing achieve fuzzy matching, for example: delete (temp1.doc, temp2.doc, temp3.doc, temp4.doc~~) and keep temp1.doc by keeping temp2~~.doc.
Note: temp is just a placeholder for the files to be processed.
Floor8 electronixtar Posted 2006-10-26 20:58
铂金会员 Posts 2,672 Credits 7,493
It's very simple, copy out temp1.doc and delete the folder.
Floor9 WinXYhappy Posted 2006-10-26 23:56
初级用户 Posts 14 Credits 30
Originally posted by electronixtar at 2006-10-26 08:58 PM:
It's very simple. Copy out temp1.doc and delete the folder;

So depressed!
But I guess that's how scholarship is!

What I mean is I know the name of this folder, but I don't know the names of the files in the folder (so the above temp is just a placeholder,...... a placeholder. Not actual). Because there are too many files, I can't list them one by one.
For example for example for example for example:
There are temp1.doc, temp2.doc, temp3.doc~~
tmp1.xls, tmp2.xls, tmp3.xls~~
study1.txt, study2.txt~~
***1.gif, ***2.gif~~~~

So the function of dir also needs to be implemented in del.bat, and also find (***) then perform the function of deleting duplicate files. I don't know if electronixtar understands. Oh my expression ability, so...... hahaha. electronixtar needs to carefully figure out my meaning. Thanks.
Floor10 electronixtar Posted 2006-10-27 00:09
铂金会员 Posts 2,672 Credits 7,493
If this operation is only done once, you can complete it through Windows' search function, heh heh~
Floor11 electronixtar Posted 2006-10-27 00:11
铂金会员 Posts 2,672 Credits 7,493

Hahaha, I spent the whole morning looking at everything related to deletion. It doesn't seem to fit my conditions.

That was he200377 who misread it. I also thought it was a really stubborn duplicate file when I saw the title of the original poster, but it turned out to be a duplicate file. Hehe
Floor12 不得不爱 Posted 2006-10-27 01:10
超级版主 Posts 2,044 Credits 5,310 From 四川南充
This question is a bit difficult
Floor13 vkill Posted 2006-10-27 01:15
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
If you want to delete duplicate file contents, it's not easy.
Floor14 WinXYhappy Posted 2006-10-27 02:46
初级用户 Posts 14 Credits 30
No, I need to repeat it many times. There are too many, so I want to write a batch script to do it. I'm not very capable myself, so I'm here to ask for help from all the experts. Hahaha
Floor15 electronixtar Posted 2006-10-27 02:52
铂金会员 Posts 2,672 Credits 7,493
Remember a software called: Duplicate File Finder
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023