View Single Post
  #71  
Old 2020-04-29, 07:58 AM
gwendibbley gwendibbley is offline
 
Join Date: Feb 2005
Re: Checksums Demystified (.st5, .ffp and .md5)

This vbscript searches through all the folder in the pre-defined root folder for files ending with st5, ffp, md5, sfv and txt (checksums could be inside a file named fingerprints.txt, how to deal with those?).

You could try this for yourself and then look at the output file for the result.

Code:
Option Explicit

'Declaration
Dim fso, arr1, File, SubFolder, oItem, strWriteLine, strText, strOutputFile

'System variables
Const ForReading = 1

'User variables
Const rootFolder = "C:\Temp\Test"
Const OutputFile = "C:\Temp\FindChecksumFileoutput.txt"
Const debugging = 1
Const Logging = 1

Set fso = CreateObject("Scripting.FileSystemObject")
Set strOutputFile = fso.CreateTextFile(OutputFile)
arr1 = Array(".st5", ".ffp", ".md5", ".sfv", ".txt")

FindChecksumFile fso.GetFolder(rootFolder)

strOutputFile.WriteLine strWriteLine
strOutputFile.Close

Set fso = Nothing

Sub FindChecksumFile(Folder)
  For Each File In Folder.Files
  	For Each oItem In arr1
	    If InStr(LCase(File.Name), oItem) > 0 Then
	    	If oItem = ".st5" Then
	    		Checkst5(File)
	    	ElseIf oItem = ".ffp" Then
	    		Checkffp(File)
	    	ElseIf oItem = ".md5" Then
	    		Checkmd5(File)
	    	ElseIf oItem = ".sfv" Then
	    		Checksfv(File)
	    	ElseIf oItem = ".txt" Then
	    		Checktxt(File)
	    	End If
	    End If
    Next
  Next

  For Each SubFolder In Folder.SubFolders
    FindChecksumFile SubFolder
  Next
End Sub

Sub Checkst5(inputfile)
	'WScript.Echo inputfile.Path
	strText = inputfile.Path
	strWriteLine = strWriteLine & strText & vbCrLf
End Sub

Sub Checkffp(inputfile)
	'WScript.Echo inputfile.Path
	strText = inputfile.Path
	strWriteLine = strWriteLine & strText & vbCrLf
End Sub

Sub Checkmd5(inputfile)
	'WScript.Echo inputfile.Path
	strText = inputfile.Path
	strWriteLine = strWriteLine & strText & vbCrLf
End Sub

Sub Checksfv(inputfile)
	'WScript.Echo inputfile.Path
	strText = inputfile.Path
	strWriteLine = strWriteLine & strText & vbCrLf
End Sub

Sub Checktxt(inputfile)
	'WScript.Echo inputfile.Path
	strText = inputfile.Path
	strWriteLine = strWriteLine & strText & vbCrLf
End Sub
Let me know what you think..

/G
Reply With Quote Reply with Nested Quotes