From d5219e90f4fa7596473626c056adda26bb879f82 Mon Sep 17 00:00:00 2001 From: eeckert Date: Mon, 2 Oct 2023 16:08:58 -0600 Subject: [PATCH] remove last reference to Project --- Get-ProjectFolders.ps1 | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Get-ProjectFolders.ps1 b/Get-ProjectFolders.ps1 index fdb5ea3..6b2be4a 100644 --- a/Get-ProjectFolders.ps1 +++ b/Get-ProjectFolders.ps1 @@ -108,11 +108,11 @@ $OfficeList | ForEach-Object -parallel { $Path = $Path.Replace("X:\", "\\mpe.ca\datadrive\") $projectnumber = $result.tostring() $DBConnect = New-SqliteConnection -DataSource $PathToDB_Copy - $Query = "Select Project,fld_LastRefresh FROM FolderData where Server = '$Server' AND Path = `"$Path`";" + $Query = "Select fld_LastRefresh FROM FolderData where Server = '$Server' AND Path = `"$Path`";" $sql_result = Invoke-SqliteQuery -DataSource $PathToDB_Copy -Query $Query - if (($sql_result.project -eq $null) -or ($sql_result.fld_LastRefresh -le (Get-Date).AddDays($RefreshDays).ToShortDateString())) { + if (($sql_result.fld_LastRefresh -le (Get-Date).AddDays($RefreshDays).ToShortDateString())) { $CurentLoopProgress = @{ ID = $JobID Activity = "Loading Telemetry for " + $_.FullName @@ -120,15 +120,7 @@ $OfficeList | ForEach-Object -parallel { } Write-Progress @CurentLoopProgress - - if ($sql_result.project -ne $null) { - # found a record, but needs updating - delete old record from DB - $Query = "Delete from FolderData WHERE Server = '$Server' AND Path = `"$Path`"" - Invoke-SqliteQuery -DataSource $PathToDB_Copy -Query $Query - - - } - + $result3 = [Regex]::Matches($_.FullName, "^(.*[\\\/])") # This gets everything up the last slash, thus the "parent" $FolderPath_Data = Get-ChildItem -Path $_.FullName -File -Depth 50 -Recurse $folder_Parent = $result3.value.replace("'", "`'") #SQL Formatting