Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Comparing dates and then archive files greater than 14 days

$
0
0

If you cast a date time string as an actual datetime object, you can compare them.

[datetime]$x = “11/22/1971 10:45 AM”
$y = Get-Date

if ($x -gt $y) {
#whatever
}

I believe the date you’re looking at on the file object is already a date/time, so you should just be able to do a straight comparison.


Viewing all articles
Browse latest Browse all 13067

Trending Articles