CCCPaste

Get time ranges in log files

## Search log files with lines starting with "2025-10-01T11:18:37.843" like date format to get first and last timestamps to show what time ranges are in the log file to help locate info

ls your_log_folder -PipelineVariable file | ForEach-Object { $dates = @( sls '^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d+' -Path $file.FullName ) ; if( $dates.Count -gt 0 ) { [pscustomobject]@{ File = $file.Name ; Start = "$(([datetime]($dates[0].matches[0].value)).ToString('G'))"; End = $(if($dates.Count -gt 1) { "$(([datetime]($dates[-1].matches[0].value)).ToString('G'))" } ); 'Duration(m)' = $(if($dates.Count -gt 1) { ([datetime]$dates[-1].matches[0].value - [datetime]$dates[0].matches[0].value).TotalMinutes } )} } }