Delete :Zone.Identifier stream in Batch mode

English support forum

Moderators: Stefan2, white, sheep, Hacker

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

Delete :Zone.Identifier stream in Batch mode

Post by *Strogg » 2019-08-18, 08:33 UTC

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: 6678
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Dalai » 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:

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
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups

User avatar
Stefan2
Power Member
Power Member
Posts: 2588
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Stefan2 » 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...
Inofficial FAQs || WIKI (Deu/Eng) || TC Home (What's new? // FAQ // Download // Order // Addons // Tools // Plugins)
Erst wenn der letzte Baum gefällt oder die letzte Biene verendet ist, werden die Leute verstehen warum Umweltschutz wichtig ist.

User avatar
Horst.Epp
Power Member
Power Member
Posts: 3394
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Horst.Epp » 2019-08-18, 17:04 UTC

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 10 Home x64 May 2019 Update, Version 1903 (OS Build 18362.329)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.22a x64 and x86, Everything 1.4.1.949 (x64)

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

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg » 2019-08-18, 18:31 UTC

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: 11266
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Hacker » 2019-08-18, 19:08 UTC

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: 84
Joined: 2003-08-24, 17:16 UTC
Location: Georgia

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg » 2019-08-18, 19:50 UTC

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: 6678
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Dalai » 2019-08-18, 20:04 UTC

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

Regards
Dalai
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups

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

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg » 2019-08-19, 08:00 UTC

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: 2588
Joined: 2007-09-13, 22:20 UTC
Location: Europa

VBScript: :Zone.Identifier stream in Batch mode

Post by *Stefan2 » 2019-08-19, 10:07 UTC

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)		 
'//=============================================================

Inofficial FAQs || WIKI (Deu/Eng) || TC Home (What's new? // FAQ // Download // Order // Addons // Tools // Plugins)
Erst wenn der letzte Baum gefällt oder die letzte Biene verendet ist, werden die Leute verstehen warum Umweltschutz wichtig ist.

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

Re: Delete :Zone.Identifier stream in Batch mode

Post by *Strogg » 2019-08-19, 18:37 UTC

2Stefan2
Thanks Stefan for your help. it works!

Post Reply