Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Script - Empty folders

$
0
0

Hi,

I would like to write a script to find from when  a folder is empty  and/or  also would like to check if there is no files written to that folder from past 30 mins.

lastwritetime is not good option to select here as it doesn't give accurate result. Is ther a way we can achieve this.

$test = Get-ChildItem -Path "C:\test" -recurse | where-object {$_.name -eq "New folder"} | where-object {$_.lastwritetime -gt (get-date).AddMinutes(-30)} | where-object {$_.PSIsContainer} | Select-Object {$_.Name}
$test1 = ($test | Measure-Object).Count
$test1


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>