中国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 13:55
48,040 topics / 350,125 posts / today 0 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » [Unresolved] Batch non-empty judgment access and deletion of slightly deformed directories
Printable Version  15,521 / 67
Floor1 plp626 Posted 2008-02-29 21:22
银牌会员 Posts 1,020 Credits 2,278
Supplement. It can be judged by combining the rd command with ||, but this will delete the empty directory with a dot. Is there any other method, like dir or something?
Declare that the code idea similar to the following is not counted. This changes the creation date of the file.

-------------------------------------------------------------------------------------------------------------
Supplementary at 17:30
Still have to rely on myself. Now I post the code for everyone to share. If it's good, collect it.
(May be invalid for other abnormal directories with dots, will be improved later.)


Attached code:

Access

Delete (Paste the code directly into the command line. Do not run it in the path where the ghost backup file is located!)

Even if there are Con, Prn, Aux, Nul, Lpt?, Com? etc. (? means numbers 1-9) in the directory that are not abnormal directories with dots, they will be deleted as well.




[ Last edited by plp626 on 2008-4-27 at 12:11 AM ]
Floor2 plp626 Posted 2008-03-01 00:40
银牌会员 Posts 1,020 Credits 2,278
No one? Did I not explain clearly enough?
Posting this thread isn't because I'm making trouble for no reason. Because some USB flash drive viruses actually exist in these malformed directories.
Files can also be stored in malformed directories.
For example, using the command

you can copy all files in the current path to the 123. folder.
Now the question is how to judge whether there are files in this malformed directory, that is, whether it's non-empty.
Hope everyone actively participates!

[ Last edited by plp626 on 2008-3-1 at 12:43 AM ]
Floor3 huahua0919 Posted 2008-03-01 12:17
银牌会员 Posts 780 Credits 1,608
Strangely enough, although the file was copied in, the attribute of its folder is still 0 bytes when checked!
Floor4 huahua0919 Posted 2008-03-01 12:18
银牌会员 Posts 780 Credits 1,608
Strangely enough, although the file was copied in, the property of its folder is still 0 bytes when checked!
Floor5 plp626 Posted 2008-03-01 14:45
银牌会员 Posts 1,020 Credits 2,278
There are quite a few abnormal directories on the machines in the school computer lab, and most abnormal directories have no files placed in them. I just want to see which directories have files.
Hope the experts can give some pointers, I'm very grateful!

[ Last edited by plp626 on 2008-3-1 at 06:59 PM ]
Floor6 plp626 Posted 2008-03-01 15:36
银牌会员 Posts 1,020 Credits 2,278
Haha. Finally figured it out.

This post is closed!

[ Last edited by plp626 on 2008-3-1 at 03:51 PM ]
Floor7 26933062 Posted 2008-03-01 17:20
银牌会员 Posts 879 Credits 2,268
The LZ has figured it out. Can you share the method?
Floor8 523066680 Posted 2008-03-01 18:42
银牌会员 Posts 1,133 Credits 2,362
Another thing is that if you put a nul\ inside a., you can't directly use Rd ae216~1 /s /q to delete it. You have to enter ae216~1 and then Rd nul... (Just a personal opinion)
Floor9 plp626 Posted 2008-03-01 19:44
银牌会员 Posts 1,020 Credits 2,278
523066680 said:
My code algorithm is designed based on the file name suffix being ".".
I will consider this when I have time combined with the first code. It shouldn't be difficult.
Floor10 plp626 Posted 2008-03-01 21:10
银牌会员 Posts 1,020 Credits 2,278
It's really troublesome to do it actually, give a test code
Please delete it:


[ Last edited by plp626 on 2008-3-1 at 09:57 PM ]
Floor11 learner0 Posted 2008-03-01 21:46
初级用户 Posts 49 Credits 108
I'm afraid we can only use start to open these abnormal directories to judge whether they are empty........
Floor12 learner0 Posted 2008-03-01 21:52
初级用户 Posts 49 Credits 108
It can also be judged using type. The test code is as follows:
md d:\1_11..\&echo %random%>d:\1_11..\11.txt&type d:\1_11..\11.txt
Floor13 h2thesun Posted 2008-03-01 23:31
初级用户 Posts 14 Credits 34
Got it. Not bad.
Floor14 slore Posted 2008-03-02 00:05
铂金会员 Posts 2,478 Credits 5,212
We see that the original folder shown is missing a dot.

If you put a 123 in the same directory.
And create a 123 directory.
When you access 123., you are actually accessing the 123 folder. So in terms of size, it can display the size of the 123 directory. If there is no 123 directory, it is 0.

The system recognizes 123. as the attributes of 123... So you can't see the actual size, and the same reason you can't double-click to access it is this. After you create 123, it is equivalent to accessing the 123 folder.

You can also delete 123., and there is no error prompt, because it will delete the 123 directory.

PS:
I don't know if you can guess after reading the above?

Accessing a directory with a dot is not necessarily starting with start...

Once you know the above, it's easy to understand...
It should be original hehe. At least I didn't copy it from elsewhere.




md 123...\
Accessing this directory is accessing that abnormal directory with a dot, and you can also get information like size~
Floor15 26933062 Posted 2008-03-02 00:34
银牌会员 Posts 879 Credits 2,268
Hehe, this has been discussed long ago.

What you are accessing are all the information of the 123 directory. In fact, the 123... directory still exists, and the content inside it you can't see by double-clicking the 123 directory.
1 2 3 45  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023