commit
951d3f9a06
1 changed files with 3 additions and 6 deletions
|
|
@ -46,7 +46,7 @@ function get-killstats {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Get the latest file in the directory by last modification time
|
|
||||||
try {
|
try {
|
||||||
$filesarray = @()
|
$filesarray = @()
|
||||||
$files = Get-ChildItem -Path "$scriptroot/../data/archive/" -File -ErrorAction Stop
|
$files = Get-ChildItem -Path "$scriptroot/../data/archive/" -File -ErrorAction Stop
|
||||||
|
|
@ -56,17 +56,14 @@ try {
|
||||||
$culture = [Globalization.CultureInfo]::InvariantCulture
|
$culture = [Globalization.CultureInfo]::InvariantCulture
|
||||||
$dateTime = [datetime]::ParseExact($dateinfile, $format, $culture)
|
$dateTime = [datetime]::ParseExact($dateinfile, $format, $culture)
|
||||||
$filesarray += [PSCustomObject]@{name = $file.Name; date = $dateTime }
|
$filesarray += [PSCustomObject]@{name = $file.Name; date = $dateTime }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$latestFile = ($filesarray | where-object { ($_.date -gt (get-date).AddDays(-2)) -and ($_.date -lt (get-date).AddDays(-1))} | Sort-Object date)[0]
|
||||||
$latestFile = ($filesarray | where-object { ($_.date -gt (get-date).AddDays(-2)) -and ($_.date -lt (get-date).AddDays(-1))} | Sort-Object date)[-1]
|
|
||||||
$latestFile = Get-Item -Path "$scriptroot/../data/archive/$($latestFile.name)"
|
$latestFile = Get-Item -Path "$scriptroot/../data/archive/$($latestFile.name)"
|
||||||
Write-Output "Found file $($latestFile.FullName)"
|
Write-Output "Found file $($latestFile.FullName)"
|
||||||
|
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
$latestFile = @()
|
$latestFile = @()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Display the result
|
# Display the result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue