almost whoops

This commit is contained in:
Erik Eckert 2023-09-14 12:08:37 -06:00
parent 9ec984924d
commit aa427a1423

View File

@ -13,7 +13,7 @@ X:\CG | ProjectNumber | FullPath | filecount
#> #>
$Refresh = $false #refresh all data - causes the DB to be wiped clean and all file folders to be re-analyzed. $Refresh = $true #refresh all data - causes the DB to be wiped clean and all file folders to be re-analyzed.
$PathToDB = "M:\IT\Egnyte\DuplicateFiles\WorkingRun\Dedupe.SQLite" $PathToDB = "M:\IT\Egnyte\DuplicateFiles\WorkingRun\Dedupe.SQLite"
@ -22,8 +22,19 @@ $BaseDrive = 'X:\'
$ProjectRegex = '^X:\\[A-Z]{2}\W\d{2}\\\d{2}' $ProjectRegex = '^X:\\[A-Z]{2}\W\d{2}\\\d{2}'
$OfficeList = Get-ChildItem -Path $BaseDrive -Directory -Depth 0 $OfficeList = Get-ChildItem -Path $BaseDrive -Directory -Depth 0
if ($Refresh) {
# Reset the DB, start fresh
$DBConnect = New-SqliteConnection -DataSource $PathToDB
$ClearQuery = 'DELETE FROM FolderData;'
Invoke-SqliteQuery -DataSource $PathToDB -Query $ClearQuery
$DBConnect.close()
}
$OfficeList | ForEach-Object -parallel { $OfficeList | ForEach-Object -parallel {
$Refesh_Copy_Main = $USING:Refresh
$PathToDB_Copy_Main = $USING:PathToDB $PathToDB_Copy_Main = $USING:PathToDB
$ServerProgress = @{ $ServerProgress = @{
ID = 1 ID = 1
@ -42,7 +53,6 @@ $OfficeList | ForEach-Object -parallel {
# We need to get a file count for each "last" folder - IE, 001 in the example 1234-567-001. # We need to get a file count for each "last" folder - IE, 001 in the example 1234-567-001.
$ProjectFolders | ForEach-Object -ThrottleLimit 15 -Parallel { $ProjectFolders | ForEach-Object -ThrottleLimit 15 -Parallel {
$Refresh_Thread = $USING:Refresh_Copy_Main
$PathToDB_Copy = $USING:PathToDB_Copy_Main $PathToDB_Copy = $USING:PathToDB_Copy_Main
$JobID = Get-Random $JobID = Get-Random
@ -54,16 +64,6 @@ $OfficeList | ForEach-Object -parallel {
# Write-Progress @CurentLoopProgress # Write-Progress @CurentLoopProgress
if ($Refresh_Thread) {
# Reset the DB, start fresh
$DBConnect = New-SqliteConnection -DataSource $PathToDB_Copy
$ClearQuery = 'DELETE FROM FolderData;'
Invoke-SqliteQuery -DataSource $PathToDB_Copy -Query $ClearQuery
}
$projectNumber = '' $projectNumber = ''
# thank you ChatGPT # thank you ChatGPT