missed one

This commit is contained in:
Erik Eckert 2023-10-02 16:17:35 -06:00
parent d5219e90f4
commit f507c76740

View File

@ -73,40 +73,13 @@ $OfficeList | ForEach-Object -parallel {
# Write-Progress @CurentLoopProgress
$projectNumber = ''
# thank you ChatGPT
$string = $_.FullName
$regex = "\\(\d+(-\d+)*)"
$matches = [regex]::Matches($string, $regex)
$result = ""
foreach ($match in $matches) {
$result += $match.Groups[1].Value
if ($match.Groups[2].Success) {
$result += $match.Groups[2].Value
}
# if ($match.Groups[3].Success) {
# $result += $match.Groups[3].Value
# }
}
# / Thank you Chat GPT
# $result = $result -replace ('-','')
if ($result.Length -lt 5 ) {
# $CurentLoopProgress = @{
# ID = $JobID
# Activity = $_.FullName + " Not a Project"
# }
# Write-Progress @CurentLoopProgress
}
elseif ($result.Length -ge 5) {
$RefreshDays = -15 - (Get-Random -Maximum 5)
$Server = $_.FullName.Substring(1, 4) -replace (':|\\', '')
$Path = $_.FullName.Replace("'", "`'") #SQL Formatted Path
$Path = $Path.Replace("X:\", "\\mpe.ca\datadrive\")
$projectnumber = $result.tostring()
$DBConnect = New-SqliteConnection -DataSource $PathToDB_Copy
$Query = "Select fld_LastRefresh FROM FolderData where Server = '$Server' AND Path = `"$Path`";"
$sql_result = Invoke-SqliteQuery -DataSource $PathToDB_Copy -Query $Query
@ -154,7 +127,7 @@ $OfficeList | ForEach-Object -parallel {
}
}
$DBConnect.Close()
}
Write-Progress @CurentLoopProgress -Completed
}
Write-Progress @ServerProgress -Completed