DEL /Q?

May 20, 2008
11,424
99
Syracuse, NY, USA
I did something screwy and wound up with a lot of 0-byte files in v:\. So I gave the command

Code:
do file in /a:-d * (if %@filesize[%file] == 0 del /q %file)

It deleted all but one quietly. The very last one was named with the single Greek letter Pi. When it got to that file, I got

Code:
V:\π : Are you sure (Y/N)? ^C

Now it's the only one left, and ...

Code:
v:\> do file in /a:-d * (if %@filesize[%file] == 0 (echo %file & del /q %file))
 
π
V:\π : Are you sure (Y/N)? ^C
 
May 20, 2008
11,424
99
Syracuse, NY, USA
The only attribute is "A". The character is 0xE3 in code page 437 (when I redirect DIR to a file and hexedit it). CMD deletes it (quietly). Now it's gone.

Odd ... DIR showed me the Greek letter Pi but when I ECHO %i for i=128 to 255, I don't see Pi at all (227 shows "a").
 
May 20, 2008
11,424
99
Syracuse, NY, USA
So I tried "echos > %@char[227]". Now DIR shows me a 0-byte file named "a". And DIR also shows me a directory named "a"!!!!!

I'm sure ... I have been seeing a file named Pi (the single Greek letter) for a few days.
 
May 20, 2008
11,424
99
Syracuse, NY, USA
With the help of CharMap and Explorer (renaming), I got it back ... name ... the single character U+03A0 (uppercase pi). DIR shows me the Greek letter. I can't get that with @CHAR[] and CP 437. Redirect DIR to a file and I get (again) char 227. DEL /Q behaves as before.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
Code:
C:\Test>echo foo > %@char[960]
 
C:\Test>dir
 
Volume in drive C is Windows XP    Serial number is cc26:8769
Directory of  C:\Test\*
 
3/05/2012  7:29        <DIR>    .
3/05/2012  7:29        <DIR>    ..
3/05/2012  7:29              5  π
                5 bytes in 1 file and 2 dirs    4,096 bytes allocated
  321,569,415,168 bytes free
 
C:\Test>del /q %@char[960]
C:\Test\π : Are you sure (Y/N)? Y
 
C:\Test>
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Two suggestions for unrelated aspects.
1/ Why did you not use size range in the DEL command, i.e., /[s0,0], or at least in the DO - much simpler than testing
2/ What happens in the DEL command if you enclose the filename in quotations marks: "Π"?

BTW, CP437 includes lower case greek π - apparently Windows is "smart enough" to use it to represent its upper case version Π; nice for viewing but not so nice for processing.
 
May 20, 2008
11,424
99
Syracuse, NY, USA
There have been a couple updates lately, but this bug remains. Rex, did you figure it out?

Code:
C:\Test>echo foo > %@char[960]
 
C:\Test>dir
 
Volume in drive C is Windows XP    Serial number is cc26:8769
Directory of  C:\Test\*
 
3/05/2012  7:29        <DIR>    .
3/05/2012  7:29        <DIR>    ..
3/05/2012  7:29              5  π
                5 bytes in 1 file and 2 dirs    4,096 bytes allocated
  321,569,415,168 bytes free
 
C:\Test>del /q %@char[960]
C:\Test\π : Are you sure (Y/N)? Y
 
C:\Test>
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
You get that odd prompt anytime you specify a filename consisting entirely of characters >= 256:

Code:
C:\>del %@char[0x0174]%@char[0x0113]%@char[0x0129]%@char[0x0159]%@char[0x0111]%@char[0x0147]%@char[0
x0103]%@char[0x1e41]%@char[0x0119]
C:\ŴēĩřđŇăṁę : Are you sure (Y/N)? Y
TCC: (Sys) The system cannot find the file specified.
 "C:\ŴēĩřđŇăṁę"
     0 files deleted

C:\>

/Q has no effect, and the file need not exist.
 
May 20, 2008
11,424
99
Syracuse, NY, USA
Off topic, but ...
I'm surprised what characters I can see with CP 437 and a raster font. Do you know a way (easier, more direct than below) to see all of them? I think I'm seeing all of them (that are printable with ECHO ... except '?') with this:
Code:
(for /l %i in (0,1,65535) echo %i %@char[%i]) | grepp /v \?
But they're spread out all over the Unicode range in no predictable manner.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
If you're ECHOing to the console, I don't think your code page enters into it at all. The console is Unicode, TCC is Unicode; I think the code page is only relevant when you're piping or redirecting with //UnicodeOutput=No. The real limiting factor to what you see is probably your font(s); the raster fonts probably don't include Cyrillic, Hebrew, Arabic, Thai....

Instead of 0 to 65535, you probably ought to iterate over 32-65533; and skip the ranges 128-159 (control characters) and 55296-57343 (surrogates).
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly MKLINK and Streams and DEL Support 4
S CMDebug 22 issue with del command Support 1
I Puzzling Behavior of TDRV and DEL Support 2
vefatica File system update after DEL? Support 4
vefatica DEL /R on a SUBST'd drive? Support 1
C Del /W999 2gbFile.ext / latest build / Win7 x64 / MSE / Everything Support 5
nickles WAD del unable to delete files ending in "." Support 18
D del /s /q /f asks Are you sure (Y/N)? Support 7
Steve Pitts WAD Strange output from DEL of a non-existent directory Support 7
C DEL, connected Web folder, report Support 1
R /p when used with DEL Support 1
M A possibly stupid question about the "del" command... Support 7
Peter Murschall DEL /Y prompts always ? Support 3
vefatica Files disappear in Explorer when DEL fails Support 6
S WAD DEL /E suppresses fatal ERROR messages Support 2
nickles WAD del behaves inconsistenly# Support 7
David McClelland Why the prompt to del c:\* Support 7
Steve Pitts Are you sure prompt from DEL command Support 5
Steve Pitts Problem with DEL /S+n Support 11
vefatica DEL /Q not fixed Support 7
A del /w [minor documentation fix] Support 0
S DEL /L question Support 3
krischik WAD DEL *.htm Support 7
Phileosophos What could be slowing a "del /sxz" command? Support 19
S DEL on FTP site : complaint about missing DESCRIPT.ION Support 1
vefatica del, attributes, et c. Support 0
S SELECT DEL (*D.DLL) - output curious Support 8
T DEL disregards switch when using regular expressions Support 2
S DEL unhides directories Support 9

Similar threads