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 ]
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
) )
pauseAttached 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 :eofDelete (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 ]
Recent Ratings for This Post
( 3 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| 523066680 | +2 | 2008-03-15 18:16 |
| regvip2008 | +2 | 2008-04-17 14:29 |
| qinbuer | +4 | 2008-06-29 21:27 |

