-- VB Script. List files in all zip files in folders from root, VBS
Author Nigel Rivett
Take a root folder and output files as input
Loop through all zip files in the root and subfolders
Write the zip file and file list with file name, size, date to the output file

Place the following in a file with extension  .vbs

option explicit

' Get all zip files in a folder and write the contents to a text file

dim s_path
dim d_path

s_path = "c:\test\Powershell_zip"
d_path = "c:\test\Powershell_zip\FileList.txt"

dim oFileSys
set oFileSys = CreateObject("Scripting.FileSystemObject")

dim oFileOut
set oFileOut = oFileSys.OpenTextFile(d_path, 2, true)

dim oShell
set oShell = CreateObject("Shell.Application")

' recursively process all folders
ProcessFolder oFileSys.GetFolder(s_path)

call oFileOut.Close()

set oShell = nothing
set oFileSys = nothing

call msgbox ("successfull")


Sub ProcessFolder(oInFolder)
dim oSubFolder
dim oFolder
dim oFile
	For Each oSubfolder in oInFolder.SubFolders
		set oFolder = oFileSys.GetFolder(oSubFolder.Path)
		for each oFile in oFolder.Files
			if right(oFile.Name,4) = ".zip" then
				call ProcessArchive (oFile.Path)
			end if
		' get next subfolder recursively
		ProcessFolder oSubfolder 
End Sub

Sub ProcessArchive (sArchiveFile)
dim sLine
dim oArchiveFileList
dim oFile
	set oArchiveFileList = oShell.NameSpace(sArchiveFile).items
	for each oFile in oArchiveFileList
		sLine = sArchiveFile & "," & oFile.Name & "," & oFile.Size & "," & DateFormat(CDate(oFile.ModifyDate))
		call oFileOut.WriteLine(sLine)
End Sub

Function DateFormat (oDate)
	DateFormat = year(oDate) & Right("0" & Month(oDate),2)  & Right("0" & Day(oDate),2) & " " & Right("0" & Hour(oDate),2) & ":" & Right("0" & Minute(oDate),2) & ":" & Right("0" & Second(oDate),2) 
End Function