I’ve gotten a bit further but am stuck now on if there are spaces in the flac filename..
Code:
Option Explicit
'Declaration
Dim fso, arr1, File, SubFolder, oItem, strWriteLine, strText, strOutputFile, wso, exe, sout, cmd, strFromProc, strErrorCode, oShell, strReturn
'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", ".flac", ".ape", ".shn")
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)
ElseIf oItem = ".flac" Then
VerifyFlac(File)
ElseIf oItem = ".ape" Then
VerifyApe(File)
ElseIf oItem = ".shn" Then
VerifyShn(File)
End If
End If
Next
Next
For Each SubFolder In Folder.SubFolders
FindChecksumFile SubFolder
Next
End Sub
Sub VerifyFlac(inputfile)
cmd = "C:\Temp\CmdlineApps\flac.exe -t " & inputfile.Path
Set oShell = WScript.CreateObject ("WScript.Shell")
strReturn = oShell.Run(cmd, 0, True)
Set oShell = Nothing
If CInt(strReturn) <> 0 Then
strText = inputfile.Path & ";ERROR"
Else
strText = inputfile.Path & ";OK"
End If
strWriteLine = strWriteLine & strText & vbCrLf
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
Sub VerifyApe(inputfile)
'WScript.Echo inputfile.Path
'strText = inputfile.Path
'strWriteLine = strWriteLine & strText & vbCrLf
End Sub
Sub VerifyShn(inputfile)
'WScript.Echo inputfile.Path
'strText = inputfile.Path
'strWriteLine = strWriteLine & strText & vbCrLf
End Sub
No members have liked this post.