I'm trying to write a script that will copy mp4 files to specific folders based on their frame height or frame rate. This is the code I have now that works but this just copies all MP4 files in a folder and subfolders to a destination folder.
How do I take it a step further and separate the files based on the frame height (720 for 720p files and 1080 for 1080i files)?
Option Explicit
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objSTR, objMP4dest, objXCHANGEdest, objMP4ext, objXCHANGEext, obj720dest, obj1080dest
Dim objFILE, objFILE2, Folder, SubFolder
objSTR = "C:\Users\RMalone.SEC\Videos\MP4 Transfer Test\" 'Folder to search through
objMP4dest = "C:\Users\RMalone.SEC\Videos\MP4 Destination\" 'Folder I want mp4 files to copy to
obj720dest = "C:\Users\RMalone.SEC\Videos\MP4 Destination\720p 60fps\"
'Folder for 720p 60fps files
obj1080dest = "C:\Users\RMalone.SEC\Videos\MP4 Destination\1080 30fps"
'Folder for 1080i 30fps files
objXCHANGEdest = "C:\Users\RMalone.SEC\Videos\Finished\" 'Folder I want xchange files to copy to
objMP4ext = "mp4"
objXCHANGEext = "xchange"
For Each objFILE in objFSO.GetFolder(objSTR).Files
If objFSO.GetExtensionName(objFILE.Path) = objMP4ext Then
objFILE.Copy objMP4dest
End If
Next
For Each objFILE in objFSO.GetFolder(objSTR).Files
If objFSO.GetExtensionName(objFILE.Path) = objXCHANGEext Then
objFILE.Copy objXCHANGEdest
End If
Next
Call srchSUBFOLD(objFSO.GetFolder(objSTR))
Function srchSUBFOLD(Folder)
For Each SubFolder in Folder.SubFolders
For Each objFILE in objFSO.GetFolder(SubFolder.Path).Files
If objFSO.GetExtensionName(objFILE.Path) = objMP4ext Then
objFILE.Copy objMP4dest
End If
Next
Call srchSUBFOLD(SubFolder)
Next
End Function
Function srchSUBFOLD(Folder)
For Each SubFolder in Folder.SubFolders
For Each objFILE in objFSO.GetFolder(SubFolder.Path).Files
If objFSO.GetExtensionName(objFILE.Path) = objXCHANGEext Then
objFILE.Copy objXCHANGEdest
End If
Next
Call srchSUBFOLD(SubFolder)
Next
End Function