$json = Get-Content 'D:\Softwares\phpstudy_pro\WWW\fenleixinxi\tmp_img\prompt_map.json' -Raw | ConvertFrom-Json Write-Host "Total items in JSON: $($json.Count)" $needGen = @() foreach ($item in $json) { $localPath = $item.path -replace '/', '\\' if (Test-Path $localPath) { $size = (Get-Item $localPath).Length if ($size -le 10240) { Write-Host "TOO SMALL: $($item.id) - $($item.name) size=$size" $needGen += $item } } else { Write-Host "MISSING: $($item.id) - $($item.name)" $needGen += $item } } Write-Host "" Write-Host "Need to generate: $($needGen.Count)" Write-Host "Already OK (skip): $($json.Count - $needGen.Count)" $needGen | ConvertTo-Json -Depth 5 | Set-Content 'D:\Softwares\phpstudy_pro\WWW\fenleixinxi\tmp_img\need_gen.json'