|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
       『楼 主』:
[未结]带点畸形目录 批量 非空判断访问删除
使用 LLM 解释/回答一下
补充,用rd命令结合||可以判断,但这会删除带点空目录,
有没其他方法,dir 什么的?
声明类似下面的代码思想的不算,这个改变了文件的创建日期.
rd 123..\ 2>nul||echo 非空
md 123..\ 2>nul
-------------------------------------------------------------------------------------------------------------
17:30补充
还是得靠自己,现在我把代码贴出来供大家分享,不错话收藏.
(对其他畸形目录可能失效,后续完善,)
@echo off&setlocal enabledelayedexpansion
:by plp626@cn-dos.net on 2008-3-1
echo 当前目录内所有非空带点畸形目录及其包含文件如下:
set ln=----------------------------------------------
set m=0
for /f "tokens=4-5" %%a in ('dir/ad/x^|findstr /e \.') do (
echo %%b|findstr E>nul||dir/b %%a|find/v ":">nul&&(set/a m+=1
echo !m!!ln!&echo %%~dpb%%b 的目录:&echo.
dir/a/b %%a
) )
pause
另附代码:
访问
@echo off
:by plp626@cn-dos.net on 2008-3-3
if "%1"=="" dir/a&goto :eof
if "%1"=="/f" goto f
if "%1"=="/c" more "%~dpnx0"&goto :eof
if "%1"=="/?" goto syntax
set folder=%1
echo %folder%|findstr /e \.>nul&&set folder=%folder:.=\.%||(dir/a %1)
for /f "tokens=4-5" %%a in ('dir/ad/x^|findstr /e \.') do (
for /f "tokens=1-2" %%i in ('echo %%a %%b^|findstr /ec:" %folder%"') do (
dir/a/s/x %%i
) )
goto :eof
:f
dir /a/b|findstr /e \.||echo 当前路径下没有发现后缀带点目录
goto :eof
:syntax
echo dir命令的增强,可访问带点畸形目录.&echo.
echo /f 查看当前路径下的畸形目录
echo /c 查看%~nx0的源代码. &echo.
echo usage1:
echo 访问畸形目录时直接输入你所看到的畸形目录名.
echo 访问畸形目录内的目录用短名.(后续将改进)
echo 访问常规目录与dir命令同,有空个时加上双引号.
echo.&echo example:
echo 访问123.目录: %~n0 123.
goto :eof
删除(直接粘贴代码到命令行下.切勿在ghost备分文件所在路径下运行!)
即使目录内存放Con, Prn, Aux, Nul, Lpt?, Com?等(?表示数字1-9)非带点畸形目录也照删。
::删当前目录内任意带点畸形目录
for /f "delims=" %a in ('dir/ad/b^|findstr /e "\."') do rd /q/s "\\?\%a" 2>nul
::删当前目录,包括子目录内的任意带点畸形目录
for /f "delims=" %a in ('dir/ad/s/b^|findstr /e "\."') do rd /q/s "\\?\%a" 2>nul
::在当前路径目录树下 删任意带点空畸形目录 显示 非空畸形目录
for /f "delims=" %a in ('dir/ad/s/b^|findstr /e "\."') do rd "%a.\" 2>nul||echo %a
Last edited by plp626 on 2008-4-27 at 12:11 AM ]
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.
rd 123..\ 2>nul||echo Not empty
md 123..\ 2>nul
-------------------------------------------------------------------------------------------------------------
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.)
@echo off&setlocal enabledelayedexpansion
:by plp626@cn-dos.net on 2008-3-1
echo The following are all non-empty abnormal directories with dots in the current directory and their contained files:
set ln=----------------------------------------------
set m=0
for /f "tokens=4-5" %%a in ('dir/ad/x^|findstr /e \.') do (
echo %%b|findstr E>nul||dir/b %%a|find/v ":">nul&&(set/a m+=1
echo !m!!ln!&echo The directory of %%~dpb%%b:&echo.
dir/a/b %%a
) )
pause
Attached code:
Access
@echo off
:by plp626@cn-dos.net on 2008-3-3
if "%1"=="" dir/a&goto :eof
if "%1"=="/f" goto f
if "%1"=="/c" more "%~dpnx0"&goto :eof
if "%1"=="/?" goto syntax
set folder=%1
echo %folder%|findstr /e \.>nul&&set folder=%folder:.=\.%||(dir/a %1)
for /f "tokens=4-5" %%a in ('dir/ad/x^|findstr /e \.') do (
for /f "tokens=1-2" %%i in ('echo %%a %%b^|findstr /ec:" %folder%"') do (
dir/a/s/x %%i
) )
goto :eof
:f
dir /a/b|findstr /e \.||echo No abnormal directory with suffix dot found in the current path
goto :eof
:syntax
echo Enhanced dir command, can access abnormal directories with dots.&echo.
echo /f View abnormal directories in the current path
echo /c View the source code of %~nx0. &echo.
echo usage1:
echo When accessing abnormal directories, directly enter the abnormal directory name you see.
echo When accessing directories in abnormal directories, use the short name. (Will be improved later)
echo When accessing normal directories, it is the same as the dir command. If there are spaces, add double quotes.
echo.&echo example:
echo Access 123. directory: %~n0 123.
goto :eof
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.
::Delete any abnormal directory with dot in the current directory
for /f "delims=" %a in ('dir/ad/b^|findstr /e "\."') do rd /q/s "\\?\%a" 2>nul
::Delete any abnormal directory with dot in the current directory and its subdirectories
for /f "delims=" %a in ('dir/ad/s/b^|findstr /e "\."') do rd /q/s "\\?\%a" 2>nul
::Delete any empty abnormal directory with dot in the directory tree of the current path and display non-empty abnormal directories
for /f "delims=" %a in ('dir/ad/s/b^|findstr /e "\."') do rd "%a.\" 2>nul||echo %a
Last edited by plp626 on 2008-4-27 at 12:11 AM ]
|
|
2008-2-29 21:22 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
没人? 是我说的不很明白吗?
发这个帖子不是我没事整事,因为有些U盘病毒竟然就存在这畸形目录里.
畸形目录里也可以存放文件的,
比如用命令
copy *.* 123..\
就可以将当前路径下的所有文件复制到123.文件夹里.
现在就是怎么判断这畸形目录里是否有文件存在,即是否非空.
望大家踊跃参与!
Last edited by plp626 on 2008-3-1 at 12:43 AM ]
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
copy *.* 123..\
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 ]
|
|
2008-3-1 00:40 |
|
|
huahua0919
银牌会员
    
积分 1608
发帖 780
注册 2007-10-7
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
说来奇怪,虽然文件被拷贝进去,但是查看其文件夹属性仍为0字节!
Strangely enough, although the file was copied in, the attribute of its folder is still 0 bytes when checked!
|
|
2008-3-1 12:17 |
|
|
huahua0919
银牌会员
    
积分 1608
发帖 780
注册 2007-10-7
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
说来奇怪,虽然文件被拷贝进去,但是查看其文件夹属性仍为0字节!
Strangely enough, although the file was copied in, the property of its folder is still 0 bytes when checked!
|
|
2008-3-1 12:18 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
学校机房里的机子有不少畸形目录里,而大多畸形目录没有放文件,
我就是要看看有那些目录里有文件,
望达人指点迷津,偶不胜感激!
Last edited by plp626 on 2008-3-1 at 06:59 PM ]
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 ]
|
|
2008-3-1 14:45 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
哈哈.终于想出来了.
此贴已结!
Last edited by plp626 on 2008-3-1 at 03:51 PM ]
Haha. Finally figured it out.
This post is closed!
Last edited by plp626 on 2008-3-1 at 03:51 PM ]
|
|
2008-3-1 15:36 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
楼主想出来了,可否将方法共享一下?
The LZ has figured it out. Can you share the method?
|

致精致简! |
|
2008-3-1 17:20 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
再一个就是如果在 a. 里面放一个 nul\ 就不能直接用Rd ae216~1 /s /q 删除了啊
还非得进入ae216~1 然后Rd nul 啊……(只是个人观点)
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)
|
|
2008-3-1 18:42 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
523066680说的是
我的代码算法就是以文件名后缀为"."来设计的.
有时间我结合第一个代码把这个考虑进去考虑下,应该不难.
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.
|
|
2008-3-1 19:44 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
实际做起来还真麻烦,给个测试代码
请删之:
@echo off
for %%a in (plp 626 cn dos 1 0 fdf d ret 就 是 lo aux com1 nul con pp 465 漂来漂 看 ai) do (
md %%a...\ %%a...\...\
for %%b in (con nul aux com1) do (
md %%a...\%%b\
copy *.bat "%%a...\%%b\"
md %%a...\%%b\con\
) )
Last edited by plp626 on 2008-3-1 at 09:57 PM ]
It's really troublesome to do it actually, give a test code
Please delete it:
@echo off
for %%a in (plp 626 cn dos 1 0 fdf d ret 就是 lo aux com1 nul con pp 465 漂来漂 看 ai) do (
md %%a...\ %%a...\...\
for %%b in (con nul aux com1) do (
md %%a...\%%b\
copy *.bat "%%a...\%%b\"
md %%a...\%%b\con\
) )
Last edited by plp626 on 2008-3-1 at 09:57 PM ]
|
|
2008-3-1 21:10 |
|
|
learner0
初级用户
 
积分 108
发帖 49
注册 2008-2-26
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
恐怕只有用start打开这些畸形目录来判断其是否为空........
I'm afraid we can only use start to open these abnormal directories to judge whether they are empty........
|
|
2008-3-1 21:46 |
|
|
learner0
初级用户
 
积分 108
发帖 49
注册 2008-2-26
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
还可用type来判断,测试代码如下:
md d:\1_11..\&echo %random%>d:\1_11..\11.txt&type d:\1_11..\11.txt
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
|
|
2008-3-1 21:52 |
|
|
h2thesun
初级用户
 
积分 34
发帖 14
注册 2007-12-13
状态 离线
|
|
2008-3-1 23:31 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
我们看到显示的原本文件夹少个点。
如果你在同目录放一个123.
再建一个123目录。
你访问123.的时候就是实质访问123文件夹。所以看大小的话可以显示123目录的,如果没有123目录是0。
系统认123.是123的属性。。。所以你看不到实际的大小,同样你双击访问不了也是这个原因,你建立了123后就相当于访问123文件夹。
123.你也可以点删除了,不提示错误,因为会删除123目录。
PS:
不知道看完上面你能猜到麽?
访问带点目录不是非要start……的哦。
知道上面的了就很容易理解……
应该是原创嘿嘿。起码我不是在别的地方转的。
<img src="images/smilies/face-cool.png" align="absmiddle" border="0">
md 123...\
你访问这个目录就是访问那个畸形带.的目录,大小什么的信息也都可以滴~
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.
:cool:
md 123...\
Accessing this directory is accessing that abnormal directory with a dot, and you can also get information like size~
|
|
2008-3-2 00:05 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
呵呵,这个早有讨论过了的。
你所访问的都是123这个目录的信息,实际上123。。。这个目录还是存在的,里面的内容你通过双击123这个目录也是看不到的。
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.
|

致精致简! |
|
2008-3-2 00:34 |
|