how to remove directories structures not accessed since a specific date ?
it might look like something :
Get-ChildItem -Path $path -Recurse -Force -filter IDENTIFY_DIRECTRORY | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | IDENTIFYTHELASTACCCESSTIME | Remove-Item -Force
IDENTIFY_DIRECTORY : I guess it is : -Directory
parameter to Get-ChildItem command (select directories only not files)
IDENTIFYTHELASTACCCESSTIME : here I mean check if directory or sub-path/file has been accessed/read since a date I would set from a variable
Final goal of that is to purge useless files from a fileserver to free a maximum of space.
I already did :
Get-ChildItem -Path $path -Recurse -Force -filter *.log | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
maybe workaround
Get-ChildItem -Path "F:" $_.LastAcessTime -Recurse -Directory -Force -<somemorecommandlineparameters> ......
question from:
https://stackoverflow.com/questions/65842972/how-to-remove-directories-structures-not-accessed-since-a-specific-date 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…