MKLINK and Streams and DEL

     _x64: 1
   _admin: 1
_elevated: 1

TCC  27.00.21 x64   Windows 10 [Version 10.0.19042.867]

I have created a script called CALC.BTM, which, with the help of MKLINK, is also TAPE.BTM

The .BTM stores data into a stream file, TAPE.TXT;
e:\utils>dir calc.btm /: /km && dir tape.btm /: /km
2021-03-18  11:30             782  calc.btm
                               44    tape.txt:$DATA
2021-03-18  10:59     <SYMLINK>    tape.btm [e:\utils\calc.btm]
                               44    tape.txt:$DATA

A problem arises when I try to DEL the TAPE.BTM:TAPE.TXT file;
e:\utils>del e:\utils\tape.btm:tape.txt
Deleting E:\utils\tape.btm:tape.txt
TCC: (Sys) The system cannot find the file specified.
     0 files deleted       1 failed
...which seems to me that DEL cannot work with the Stream file of a <SYMLINK> file.

DEL works fine when I;
e:\utils>del e:\utils\calc.btm:tape.txt
Deleting E:\utils\calc.btm:tape.txt
     1 file deleted

Why can DEL not delete a Stream of a <SYMLINK> file?


@echo off

set Calc=e:\utils\calc.btm
set Tape=e:\utils\tape.btm

if not exist %Tape MKLINK %Tape %Calc > nul

if %_batchname eq %Calc Gosub Calc
if %_batchname eq %Tape Gosub Tape

iff %# eq 0 then
  echo USAGE: %_batchname 10 + 2
  echo %@formatnc[5.2,%@eval[%$]]
  echo %$ = %@formatnc[5.2,%@eval[%$]] >> %_batchname:tape.txt

iff exist %_batchname:tape.txt then
  switch %#
  case 0
    :: Tape
    tail /n10 %_batchname:tape.txt
  case 1
     switch %1
       case list
         :: Tape View
         *list %_batchname:tape.txt
       case clear
         :: This does not work.
         :: del /q %_batchname:tape.txt
         :: This works.
         del /q %calc:tape.txt
Jan 12, 2014
Switzerland, SO
The Windows API doesn't support deleting a symlink stream. Checking for this situation (by default) in DEL would slow things down (a LOT); I might consider adding a new switch, though that doesn't gain you a lot vs. just using @symlink.
However: +1 from me for a such new switch :-)
Similar threads
Thread starter Title Forum Replies Date
B MKLINK requires admin - fails silently. Support 1
Stefano Piccardi Issue: MKLINK /J creates invalid link [TCC 14.03.53] Support 4
Stefano Piccardi Fixed mklink /X junction\ Support 3
samintz Fixed GPF from MKLINK Support 1
fpefpe Fixed MKLINK Support 2
J WAD MKLINK File symlinks are absolute Support 7
J WAD MKLINK & XP Support 4
Stefano Piccardi WAD MKLINK CMD compatibility, MKLINK /X Support 6
Stefano Piccardi Fixed MKLINK /D Support 4
Stefano Piccardi 13.0.31 2 MKLINK TCC vs CMD issues Support 2
David McClelland MKLINK /x discrepancy Support 0
R No Error Message when running mklink as limited user Support 3
W mklink and Volume Shadow Copies Support 5
N mklnk / mklink problem Support 7
Joe Caverly PSHELL and NTFS File Streams Support 2
vefatica PDIR and streams Support 1
vefatica DIR /F and streams? Support 7
vefatica Finding files with alternate data streams? Support 4
vefatica REN and NTFS streams? Support 3
L How to? Character transfer among @BALLOC buffers, command tails, and possibly redirected standard streams Support 11
L alternate streams size not counted Support 7
vefatica Get a list of all files with alternate streams? Support 11
vefatica DIR, streams, and wildcards? Support 1
vefatica DIR /: /u ... streams not counted? Support 7
Joe Caverly ZIPing individual NTFS File Streams Support 4
samintz Deleting streams Support 2
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
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

Similar threads