我正在尝试编写一个脚本,该脚本将根据其帧高或帧频将mp4文件复制到特定文件夹。这是我现在可以使用的代码,但这只是将文件夹中的所有MP4文件和子文件夹复制到目标文件夹中。
如何更进一步,并根据帧高度(720p表示720p文件,而1080i表示1080i文件)来分离文件?
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
答案 0 :(得分:1)
框架高度存储在文件的扩展属性中。您可以这样访问值:
idx=[]
dta=[]
for title in tag_title:
idx.append(title.find("dt").text)
dta.append(title.find("dd").text.strip())
tag_df = pd.DataFrame(dta, index=idx)
您可以像这样标识扩展属性的名称和索引号:
dirname = "C:\your\video\folder"
Set fso = CreateObject("Scripting.FileSystemObject")
Set app = CreateObject("Shell.Application")
Set ns = app.Namespace(dirname)
For Each f In fso.GetFolder(dirname)
If LCase(fso.GetExtensionName(f)) = "mp4" Then
fheight = ns.GetDetailsOf(ns.ParseName(f.Name), 283)
Select Case fheight
Case "720" : 'copy to one location
Case "1080" : 'copy to other location
Case Else : WScript.Echo "Unknown frame height " & fheight & _
" for file " & f.Name & "."
End Select
End If
Next
注意:使用dirname = "C:\your\video\folder"
Set app = CreateObject("Shell.Application")
Set ns = app.Namespace(dirname)
For i=0 To 300
WScript.Echo i & vbTab & ns.GetDetailsOf(ns.Items, i)
Next
运行脚本,因此不会出现300个弹出窗口!