我想提到以下PowerShell來過濾文件大小
$FileExists1 = 'C:\Users\iskandar\Desktop\TEST\*\test0700.txt'
IF (Test-Path $FileExists1) {
If ((Get-Item $FileExists1).length -gt 0kb) {
Write-Output "All file size is good!"
}
Else {
Write-Output " There is a file with 0KB, Please inform support staff"
}
}
如果有多個文件夾多,腳本無法過濾0KB文件編寫使用PowerShell來獲取文件大小0KB腳本。
例如:可以說我有30個文件,只有一個文件和0KB,當我運行這些腳本時,它顯示「所有文件大小都很好!」。
任何人都可以建議嗎?謝謝