Delete :Zone.Identifier stream in Batch mode

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Strogg
Junior Member
Junior Member
Posts: 89
Joined: 2003-08-24, 17:16 UTC
Location: Georgia

Delete :Zone.Identifier stream in Batch mode

Post by *Strogg »

Good day.
I was searching for the plugin that could delete :Zone.Identifier in batch mode, but seems it doesn't exists.
So I decided to use the button with "stream" utility by Mark Russinovich. This utility has 2 parameters:
-d "delete streams"
-s "recurse subdirectories
Path to file put after indicating the parameters.

Here the code of a button:

Code: Select all

TOTALCMD#BAR#DATA  
path_to_streams.exe -s -d 
%P%N
Path to Icon  
Comment: "Delete  :Zone.Identifier from selected files or Folder"
The problem is that the button with processes only files in folder that is under the cursor, but doesn't process selected files inside folder.
How can I make it work with all selected files in folder?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Dalai »

Since Streams doesn't support multiple files/directories as parameters you need a list file and a loop. Something like this.
Batch:

Code: Select all

@echo off
if "%~1"=="" goto :EOF
for /F "delims=" %%F IN ('type "%~1"') DO (
    path_to_streams.exe -s -d "%%~F"
)
pause
Button:

Code: Select all

TOTALCMD#BAR#DATA  
path_to_streams_batch.cmd
"%WL"
Path to Icon  
Comment: "Delete  :Zone.Identifier from selected files or Folder"
This should also work with Unicode characters in filenames. Change the path to streams.exe and the batch file accordingly.

PS: It is possible to pack the batch code itself into the button, but I don't like that.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Stefan2 »

On my search I have read that you can use joker signs like

%P%N\*
%P%N\*.*

"%P%O\*"
"%P%O\*.*"


Maybe someone want to check that out...
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Horst.Epp »

Stefan2 wrote: 2019-08-18, 15:10 UTC On my search I have read that you can use joker signs like

%P%N\*
%P%N\*.*

"%P%O\*"
"%P%O\*.*"


Maybe someone want to check that out...
As Dalai already said, Streams doesn't accept a list o file names.
It can scan one file or all files in a dir and optional its sub-dirs.

One can use also use Christians Makebat plugin for such a job.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Strogg
Junior Member
Junior Member
Posts: 89
Joined: 2003-08-24, 17:16 UTC
Location: Georgia

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg »

Dalai wrote: 2019-08-18, 14:07 UTC Since Streams doesn't support multiple files/directories as parameters you need a list file and a loop. Something like this.
Batch:
Thanks for your help. Unfortunately it doesn't work. Here are 2 screenshots.
First one trying to process files in Folder (cursor is on Folder).
Second one trying to process selected files inside a folder.
[img]https://i.ibb.co/LnLWM7g/Capture1.png[/img]
[img]https://i.ibb.co/zSydQT4/Capture2.png[/img]
If streams are so complicated to process may there is an alternative?
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Hacker »

Strogg,
Just a note - your button deletes all streams, not only Zone.Identifier.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Strogg
Junior Member
Junior Member
Posts: 89
Joined: 2003-08-24, 17:16 UTC
Location: Georgia

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg »

2Hacker
Sure, I am aware of that. But I deal only with Zone.Identifier.
I'm downloading too many docs from the web during a day. Some of them are quite large, so opening is annoying and takes a time.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Dalai »

2Strogg
Are you sure these files have an ADS (stream)?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Strogg
Junior Member
Junior Member
Posts: 89
Joined: 2003-08-24, 17:16 UTC
Location: Georgia

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg »

2Dalai
Yes, have checked twice.

Update: Still use old parameters as an option:

TOTALCMD#BAR#DATA
path_to_streams -d
%P%N
Path to Icon
Comment: "Delete :Zone.Identifier from selected files or Folder"

Removed -s and now it processes folder under cursor (without subfolders) and ALL non-selected files inside folder. That should do until better solution is found.
I wish TC has this function internally.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

VBScript: :Zone.Identifier stream in Batch mode

Post by *Stefan2 »

Maybe this will work..


'// Script for Total Commander, v00.1, Stefan, 2019-08-19 Mon 11:59:55
' Execute command x for every file in all sub folders (see Function ExecuteTool)
' Works on current active TC panel folder directory

'TC Button
' Command: "D:\rive\Path to\this.vbs"
' Parameter:
' Start path:
' Icon: wciconex.dll
' Tooltip: Execute command x for every file in all sub folders


USER SETTINGS:
Startfolder = "." '//current TC active panel, working dir
Logfile = "___streamslog_1.txt"
StreamsExePath = "C:\Temp\streams.exe"


Code: Select all

'//Found at: https://ghisler.ch/board/viewtopic.php?p=358378#p358378
'// Script for Total Commander, v00.1, Stefan, 2019-08-19 Mon 11:59:55
' Execute command x for every file in all sub folders (see Function ExecuteTool)
' Works on current active TC panel folder directory
'   TC Button
'   Command: "D:\rive\Path to\this.vbs"
'   Parameter:
'   Start path:
'   Icon: wciconex.dll
'   Tooltip: Execute command x for every file in all sub folders


'//USER SETTINGS:
Logfile = "___streamslog_1.txt"
Startfolder = "."     '//current TC active panel, working dir
'// and see Function ExecuteTool below at the end, for settings of the Tool to execute !


'//=============================================================
Set FSO = CreateObject("Scripting.FileSystemObject")
SET WSO = CreateObject("WScript.Shell")

objStartFolder = FSO.GetAbsolutePathName(Startfolder)

MB = MsgBox("Work in folder: " &vbLF & objStartFolder _
	& vbLF&vbLF&"Continue: [Yes]/[No]?"&vbLF&vbLF _
	, VBYesNo+vbQuestion,"Total Commander VBScript")
If (MB = vbNo) Then WScript.Quit 
MsgBox "OK, we start... wait for the Done! message!" _
	, vbOKCancel,"Total Commander VBScript"

Set objFolder = FSO.GetFolder(objStartFolder) 

'// get Main folder "objStartFolder":
Set colFilesMainFld = objFolder.Files
For Each objFile in colFilesMainFld
    sOUT = sOUT & objFile.Path & vbCRLF
    'ExecuteTool objFile.Path
Next

'// get sub folders of "objStartFolder":
ShowSubfolders FSO.GetFolder(objStartFolder)

'//Output, write to file in current working dir:
Set NewFile = FSO.CreateTextFile(Logfile, True)
NewFile.WriteLine(sOUT)
NewFile.Close

MsgBox "Done!",VBInformation,"Total Commander VBScript"


'//=============================================================
Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders
        'Wscript.Echo Subfolder.Path
        Set objFolder = FSO.GetFolder(Subfolder.Path)
        Set colFiles = objFolder.Files
        '//If no file in folder, get just the folder name: (and add a backslash for our CreateFolderStructure script)
        If colFiles.count = 0 Then 
			Set oSubFld = objFolder.SubFolders
			If oSubFld.count = 0 Then sOUT = sOUT & objFolder.Path & "\" & vbCRLF
			Set oSubFld = Nothing
		End If
        For Each objFile in colFiles
            'objFile.Name or objFile.Path
            sOUT = sOUT & objFile.Path & vbCRLF
            ExecuteTool objFile.Path
        Next
        ShowSubFolders Subfolder
    Next
End Sub
'//=============================================================
Function ExecuteTool(strFullPath)
       '//USER SETTINGS:
	StreamsExePath = "C:\Temp\streams.exe"

	'// WSO.Run strCommand [,intWindowStyle 0=Hide 1=Activate 2=mini 3=maxi ...] [,bWaitTillFinish? True/False]
	WSO.Run StreamsExePath & " -d -nobanner " & strFullPath, 0, true
End Function 'ExecuteTool(strFullPath)		 
'//=============================================================

User avatar
Strogg
Junior Member
Junior Member
Posts: 89
Joined: 2003-08-24, 17:16 UTC
Location: Georgia

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg »

2Stefan2
Thanks Stefan for your help. it works!
Post Reply