DEL /Q?

May 20, 2008
9,349
62
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
9,349
62
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
9,349
62
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
9,349
62
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
3,846
48
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,520
3
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
9,349
62
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
3,846
48
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
9,349
62
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
3,846
48
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).