Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

powershell how to delete files or folders last updated older than x days

Get-ChildItem -Path "C:Temp	emp" -Directory -recurse| where {$_.LastWriteTime -le $(get-date).Adddays(-10)} | Remove-Item -recurse -force
Get-ChildItem -Path "C:Temp	emp" -File -recurse| where {$_.LastWriteTime -le $(get-date).Adddays(-10)} | Remove-Item -recurse -force
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #powershell #delete #files #folders #updated #older #days
ADD COMMENT
Topic
Name
5+2 =