Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done Add ability to DEL Stream from SYMLINK

Aug
1,917
68
In reference to MKLINK and Streams and DEL, the ability for DEL to recognize a SYMLINK when deleting a Stream, without first having to tell DEL it is to delete a Stream from a SYMLINK.

At present, I have to tell DEL that it is a SYMLINK.

Example;
Code:
del /q %@symlink[%_batchname]:tape.txt

Joe
 
I wonder what the problem is. Powershell can't to it either. With this set-up,

Code:
v:\> d /: aaa*;bbb*
2021-03-19  11:22               0  aaa.txt
                                5    aaa.dat:$DATA
2021-03-19  11:22     <SYMLINK>    bbb.txt [aaa.txt]
                                5    aaa.dat:$DATA

Code:
V:\> remove-item .\bbb.txt -stream aaa.dat
remove-item : Could not open the alternate data stream 'aaa.dat' of the file 'V:\bbb.txt'.
At line:1 char:1
+ remove-item .\bbb.txt -stream aaa.dat
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (V:\bbb.txt:String) [Remove-Item], FileNotFoundException
    + FullyQualifiedErrorId : AlternateDataStreamNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

But after this

Code:
V:\> remove-item .\aaa.txt -stream aaa.dat

V:\>

Code:
v:\> d /: aaa*;bbb*
2021-03-19  11:22               0  aaa.txt
2021-03-19  11:22     <SYMLINK>    bbb.txt [aaa.txt]
 
With the same set-up

Code:
v:\> d /: aaa*;bbb*
2021-03-19  11:22               0  aaa.txt
                                5    aaa.dat:$DATA
2021-03-19  11:22     <SYMLINK>    bbb.txt [aaa.txt]
                                5    aaa.dat:$DATA

this fails.

Code:
DeleteFileW(L"v:\\bbb.txt:aaa.dat");

while this succeeds

Code:
DeleteFileW(L"v:\\aaa.txt:aaa.dat");

So it's a limitation of the API. Rex would probably have to implement the same workaround internally that you have implemented externally.
 

Similar threads

Back
Top