Thought I'd share a simple script I wrote to remove the "_T00" part at the end of the files. It's Windows only, though. Usage is run the file, then enter the directory where the files are located, and press OK. It will recursively check the folders inside that folder, and any .mkv or .mp4 file it finds in there with "_txx" or " txx" (where xx = two numbers), it will get rid of it.
Copy the code, and save it in a file entitled "whatever.vbs" (the .vbs file is the important part)
Yes it works, no it's not a virus, yes it could be optimised etc. However, it works well.
If you will always be using the same folder, save time by changing the first line to:
(ie, start_folder = "C:\Video_rips")start_folder = "full_path_to_folder"
Code: Select all
start_Folder = InputBox ("Folder to Search Sub-Folders for: ")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")'
Set Folder = objFSO.GetFolder(start_Folder)
changed_files = ""
count = 0
ShowSubFolders Folder
WScript.Echo ("Changes Made: " & count)
If count <> 0 Then
WScript.Echo "Files Affected:" & vbcrlf & changed_files
End If
Sub ShowSubFolders(Folder)
Set objFolder = objFSO.GetFolder(Folder.Path)
Set allFiles = objFolder.Files
For Each objFile in allFiles
On Error Resume Next
If lcase(objFSO.GetExtensionName(objFile.Name)) = "mkv" or lcase(objFSO.GetExtensionName(objFile.Name)) = "mp4" Then
temp = Right(objFile.Name,8)
temp = Left(temp,4)
If Left(temp,1) = " " or Left(temp,1) = "_" Then
If IsNumeric(Right(temp,2)) = True Then
If lcase(Mid(temp,2,1)) = "t" Then
new_name = Left(objFile.Path,Len(objFile.Path)-8) & "." + lcase(objFSO.GetExtensionName(objFile.Name))
new_name1 = Left(objFile.Name,Len(objFile.Name)-8) & "." + lcase(objFSO.GetExtensionName(objFile.Name))
changed_files = changed_files & objFile.Name & " -> " & new_name1 & vbcrlf
objFSO.MoveFile objFile.Path, new_name
count = count + 1
End If
End If
End If
End If
Next
For Each Subfolder in Folder.SubFolders
ShowSubFolders Subfolder
Next
End Sub