WAD del unable to delete files ending in "."

Jun 24, 2008
223
0
Siegen, Germany
Given the following file entry, del isn't able to delete the file (mind the "." at the end):

06.12.2015 13:37 167 ___A___________ DSSET-~2 dsset-sub-example.net.

del "dsset-sub.example.net."
TCC: (Sys) The system cannot find the file specified.
"D:\temp\down\xx\1\dsset-sub.example.net."

0 files deleted

The same happens with ` quoting, or ' quoting, or w/o quoting. So, resorting to short file names:

del dsset-~2
Deleting D:\temp\down\xx\1\dsset-sub.example.net.
TCC: (Sys) The system cannot find the file specified.
"D:\temp\down\xx\1\dsset-sub.example.net."

0 files deleted 1 failed

The same happens with any quoting.

Only GnuWin32's rm des the trick (note: GnuWin32 is a native port not using cygwin.dll or msys.dll).

The file name does not contain any characters above 127.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,491
90
Albuquerque, NM
prospero.unm.edu
That's an invalid filename; the last character cannot be a period.

Using the short filename to delete it is the right idea, and will usually work in CMD.EXE. But TCC picks up the (illegal) long name when it canonicalizes the filename. FixNames might also help with this situation.
 
Jun 24, 2008
223
0
Siegen, Germany
Nice explanation. But what if I only had TCC at my hands. How would I get rid of the file? rm.exe (Native Win32!, MSys2 and CygWin) can do it...

Interestingly (as Charles indicated) CMD *does* remove the file. Is this WAD?
 
May 20, 2008
11,520
102
Syracuse, NY, USA
That depends on how you read it. When I read
Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not.
I think Windows does not support it.
 
Jun 8, 2013
98
0
Warsaw, Poland
For example:
upload_2015-12-17_22-36-16.png
 
Jun 8, 2013
98
0
Warsaw, Poland
NTFS in file system level does not filter almost any characters.

Limitations are built into the shell (cmd, tcc, win explorer)

as an example: windows properly displays file name " " (space alone) and ampersand (formally prohibited)
upload_2015-12-17_22-46-22.png
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
Nice explanation. But what if I only had TCC at my hands. How would I get rid of the file? rm.exe (Native Win32!, MSys2 and CygWin) can do it...

Interestingly (as Charles indicated) CMD *does* remove the file. Is this WAD?

If you want SFN support in TCC (which I STRONGLY advise against, as it's an excellent way to obliterate the contents of your disk), you need to turn it on in OPTION / Startup / Search for SFNs.

But sooner or later, you'll be sorry ...
 
Jun 8, 2013
98
0
Warsaw, Poland
Why Linux???? My roots are Unix.
In PL we are talking: "if you walked among the crows caw as they" (probably in english: "when in Rome, do as the Romans do")

It is a Windows world. Filesystem' behoviour is not dependent on master operating system (NTFS and Windows), +1 for Microsoft. Filesystem does nothing for "shell special characters".
Filesystem supports (for example) Unix/Linux native file paths, as expected.

But I don't expect that the best windows shell (TCC :) of course) should support non-windows context. If I would use file name similar to (NTFS valid) "X:<?>" or "nul" I will use proper shell/operating system.

And going back to the origin: IMHO "dsset-sub.example.net." is a valid filename, but not supported by windows.

Best regards :)
 
Jun 24, 2008
223
0
Siegen, Germany
Once again:

1) As I remarked above: "Interestingly (as Charles indicated) CMD *does* remove the file." So alone for compatibility's sake TCC should be able to do it.
2) The file was created unpacking a WinRar archive.
3) I don't care what "dunderhead" created that file (and for what motives - maybe he's a virus programmer), I want to get rid of it with TCC, not having to resort to CMD or rm.exe.
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
Once again:

1) As I remarked above: "Interestingly (as Charles indicated) CMD *does* remove the file." So alone for compatibility's sake TCC should be able to do it.
2) The file was created unpacking a WinRar archive.
3) I don't care what "dunderhead" created that file (and for what motives - maybe he's a virus programmer), I want to get rid of it with TCC, not having to resort to CMD or rm.exe.

Did you turn on SFN support in TCC?

There is no way (in any Windows shell) to get rid of that file using an LFN.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,491
90
Albuquerque, NM
prospero.unm.edu
1) As I remarked above: "Interestingly (as Charles indicated) CMD *does* remove the file." So alone for compatibility's sake TCC should be able to do it.

I'm pretty sure that the behavior you see is because TCC canonicalizes everything. (Note that in both of your original commands, the error message gives the full long filename, though you never type it that way.)

And I think that 99.99% of the time, TCC's behavior is the Right Thing. Canonicalization not only cleans up case and shows you the true path, it also has the neat side effect (in Rex's implementation) of expanding directory aliases. I would hate to see the default behavior changed just for the occasional bad filename.
 
Last edited:

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,491
90
Albuquerque, NM
prospero.unm.edu
Oh, yeah. You can delete that file -- in TCC or CMD.EXE -- with:
Code:
del "\\?\D:\temp\down\xx\1\dsset-sub.example.net."

Similar syntax to rename it, copy it, etc. I think this syntax bypasses TCC's canonicalization; Rex would know for sure.
 
Jun 24, 2008
223
0
Siegen, Germany
In cmd.exe you type: "del dsset-~2"

Ok, I can live with this behavior (having the necessary tools at hand), but on the other side, this is NOT compatible with cmd.exe (and what about the users not having rm.exe ready?).
But in that case: don't anyone stress the argument of tcc's compatbility anymore...
 
May 20, 2008
11,520
102
Syracuse, NY, USA
Nice one Charles!
Code:
v:\> ver

TCC  19.00.25  Windows 7 [Version 6.1.7601]

v:\> touch /c \\?\h:\work\x.
2015-12-18 11:13:36.391  \\?\H:\work\x.

v:\> d x*
2015-12-18  11:13  0  x.
2015-12-03  00:20  1,683  xavtemp.btm

v:\> del \\?\h:\work\x.
Deleting \\?\H:\work\x.
  1 file deleted

v:\> d x*
2015-12-03  00:20  1,683  xavtemp.btm
 
Similar threads
Thread starter Title Forum Replies Date
L How to synthesize cmd.exe's DEL /Q Support 2
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
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
vefatica DEL /Q? Support 10
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
N Unable to bind multiple keys to the same key mapping directive Support 9
A Unable to pass batch file arguments unaltered Support 18
Eric Peters New Computer, unable to register Support 3
A Unable to register TC23 Support 1
D Unable to uninstall TCC 21 Support 1
G How to? Unable to install TCMD 21 under Win2012R2 Support 5
K Unable to register TakeCommand Support 4
W Unable to register TCMD v21 Support 16
dcantor Unable to access help Support 9
WavSlave Fixed Unable to sort files by description in TCC v19 Support 2
R Unable to start any BTM file from Explorer Support 5
M I'm unable to use @replace[] with a % character in string2 Support 12
Jay Sage Unable to Specify INI File Support 19
thedave WAD Unable to type various characters using Windows 8's onscreen keyboard Support 7
Dan Glynhampton Fixed @version "force" flag not working, and unable to set separator Support 3
D ftps gives "Unable to build data connection" Support 5
M Why am I unable to delete files? Support 8
Y Unable to register v13. Support 1
Y Unable to close v13 Support 26
N Unable to end tcc.exe process Support 1

Similar threads