remove last reference to Project

This commit is contained in:
Erik Eckert 2023-10-02 16:08:58 -06:00
parent 59bab0c703
commit d5219e90f4

View File

@ -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