I am logging into the sharepoint webiste and getting folder contents as follows:
$connection = Connect-PnPOnline -Url $siteName -Credential $credential -ReturnConnection
$wholeContent = Get-PnPFolderItem -FolderSiteRelativeUrl $filePath -ItemType File -Connection $connection
$Library = $wholeContent | where { $_.Name -match "^Amma\s{1}\d{1,2}\.\d{1,2}\.\d{1,2}\.\d{1,2}\.zip$" }
Write-Output $Library
The output has the following format
Name # Type # Items/Size # Last Modified
with a list of files from which I want get the most recent file. As you have noticed from the above snippet that I used the regular expression on the "Name" attribute by $_.Name. How do I address the attribute "Last Modified" if I have to get the most recent file based on the attribute "Last Modified" ?