WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

File Operations

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

List Files with Alternate Data Streams

 Keywords: xEnumStreams List Enumerate FileItemize File Alternate Data Stream Streams ADS zoneidentifier 

See Also: Files Alternate Data Stream UDFs

;***************************************************************************
;**
;**  Locate all files with an Alternate Data Stream (ADS)
;**
;***************************************************************************


;Load Appropriate Extender
If WinMetrics(-2) == 3 Then AddExtender("WWFAF64I.DLL") ; 64-bit
Else AddExtender("WWFAF44I.DLL") ; 32-bit

If WinMetrics(-2) == 3 Then AddExtender("WILX64I.DLL") ; 64-bit
Else AddExtender("WILX44I.DLL") ; 32-bit

RootDir = "c:\temp\"
FileMask = '*'

ADSlist = ''

fsRecurse = 16  ; Look in sub directories
; Open a search handle
fsHandle = fafOpen( RootDir, FileMask, fsRecurse )
; Search for a specific file
nCount = 0
While 1
   sFound = fafFind( fsHandle )
   If sFound == "" Then Break
   arrStream = xEnumStreams( sFound, 0 )
   If ArrInfo(arrStream, 1 ) > 0
      If ADSlist == "" Then ADSlist = sFound
      Else ADSlist = ADSlist:@TAB:sFound
      nCount = nCount + 1
   EndIf
EndWhile

fafClose(fsHandle)
AskItemlist('ADS files: ':nCount , ADSlist, @TAB, @UNSORTED, @SINGLE )
Exit
Notes: The WIL function FileDelete fully supports alternate streams, so deleting a stream is no more complex than deleting a file:
StrStreamName = 'zone.identifier'
FileDelete(StrCat(strFile,":",StrStreamName ))

Article ID:   W17876
Filename:   List Files with Alternate Data Streams.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38