Last active
January 4, 2016 05:28
-
-
Save wqweto/8574945 to your computer and use it in GitHub Desktop.
Dumps audio file bitrate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for /f "tokens=1-2 delims=|" %%i in ('cscript //nologo bitrate.vbs /f:"%~1" /m:"%~2"') do ( | |
if %%j LSS 320 echo %%i has bitrate %%j and will be deleted | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sFolder = WScript.Arguments.Named("f") | |
sMask = WScript.Arguments.Named("m") | |
If LenB(sFolder) = 0 Then | |
WScript.echo "usage: " & WScript.ScriptName & " /f:folder [/m:mask]" | |
WScript.Quit 1 | |
End If | |
If LenB(sMask) = 0 Then | |
sMask = "mp3" | |
End If | |
Set oFileMatch = New RegExp | |
oFileMatch.IgnoreCase = True | |
If Left(sMask, 1) = "/" Then | |
oFileMatch.Pattern = Mid(sMask, 2) | |
Else | |
oFileMatch.Pattern = "\." & Replace(sMask, ".", vbNullString) & "$" | |
End If | |
Set oBitRateStrip = New RegExp | |
oBitRateStrip.Global = True | |
oBitRateStrip.Pattern = "[^\d]" | |
GetBitrate CreateObject("Shell.Application").Namespace(sFolder) | |
Function GetBitrate(oFolder) | |
For Each oFile In oFolder.Items | |
If oFile.IsFolder Then | |
GetBitrate oFile.GetFolder | |
ElseIf oFileMatch.Test(oFile.Name) Then | |
sBitRate = oBitRateStrip.Replace(oFolder.GetDetailsOf(oFile, 28), vbNullString) | |
If LenB(sBitRate) <> 0 Then | |
WScript.echo oFile.Path & "|" & sBitRate | |
End If | |
End If | |
Next | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment