Friday, January 5, 2018

Delete files in a folder and subfolders of files based on last access time

Get-ChildItem -path "D:\ftp.archived.logs" -Recurse | Where-Object{$_.LastAccessTime -lt (get-date).AddDays(-90)} | remove-item 

add -whatif at the end of remove-item to show what will get removed.



No comments:

Post a Comment

Thank you for your comment.