TriFused - IT Stuff
Technology, Windows, Linux, and other IT Stuff
Monday, March 23, 2020
Delete files older than 30 days but not the first of the month
# Delete files older than 30 days that are not day 1 (fist of the month)
Get-ChildItem -path \\big-nas\Data\Backup\Database -r | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30)) -and (($_.LastWriteTime).day -ne 1 )} |remove-item
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment