Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Getting latest file name from file and test

$
0
0

Normal 0 false false false EN-IE X-NONE X-NONE

Hello,

 Wondering if the below scenario is possible

 I have a folder that contains flat files and are named in sequence 111,112,113,114 etc

 Each day I would like take the latest file name and make sure it matches with the number in another flat file

 The output piece works (In bold below) and it emails but without any of the output in the body.

 

Anyone help?

 

$dir = "E:\db\revs\"

$latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1;

$latest.name

114

$name;Get-Content -Path E\db\revs\current | Select-Object -First 1

114  esh0 col

 

Send-MailMessage -SmtpServer "mailserver.domain.local" -From "nidge@me.com" -To"nidge@me.com" -Subject "File Status"


Viewing all articles
Browse latest Browse all 8583

Trending Articles