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

Reply To: Compare file creation date with current date and send email

$
0
0

For sending an email, use the Send-MailMessage cmdlet (run Get-Help Send-MailMessage -Full to learn about its options). I’m not sure which file you want to send, but here’s a generic example for finding the newest file in a folder:

$folder = 'c:\path\to\something\'

Get-ChildItem -Path $folder |
Where-Object { $_.PSIsContainer -eq $false } |
Sort-Object -Descending -Property LastWriteTime |
Select-Object -First 1

Viewing all articles
Browse latest Browse all 13067

Trending Articles