
在 Windows 7 上,我有 120 個 Zip 文件,每個 Zip 都包含映像。
有沒有任何實用程式或軟體可以讓我確認所有 120 個 Zip 中總共有多少張影像?
答案1
你可以嘗試這樣的命令:
rar -t *.zip |find /i ".jpg" /c
-t
測試檔案(並列出文件)
find
以獲取文件名中包含的所有文件.jpg
並對/c
它們進行計數
答案2
此 PowerShell 腳本將計算.jpg
該資料夾及其子資料夾中所有 Zip 檔案中的檔案數:
$ZipRoot = 'C:\Path\To\Folder'
$Count = 0
$ZipFiles = Get-ChildItem -Path $ZipRoot -Recurse -Filter '*.zip'
$Shell = New-Object -ComObject Shell.Application
$Results = foreach( $ZipFile in $ZipFiles ){
$Count += $Shell.NameSpace($ZipFile.FullName).Items() |
Where-Object { $_.Name -match '\.jpg$' } |
Measure-Object |
Select-Object -ExpandProperty Count
}
Write-Host "Count= ", $Count
答案3
.jpg
使用某些 Linux shell 來計算目前資料夾中多個 zip 內的檔案總數(能可在 Windows 上存取):
find . -maxdepth 1 -type f -name '*.zip' -exec unzip -l {} \; | grep -c '\.jpg$'
例如,如果資料夾包含:
a.zip
123.zip
test.zip
[...]