clean up output folder if needed.

This commit is contained in:
Erik Eckert 2023-09-15 11:03:39 -06:00
parent ab692c9632
commit 111f4dbb91

View File

@ -178,6 +178,7 @@ foreach ($office in $OfficeList) {
if ($sql_result) {
$OutFile = $OutputFolder + "\$OfficeServer Duplicates.xlsx"
Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter
}
@ -188,6 +189,7 @@ $sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
if ($sql_result) {
$OutFile = $OutputFolder + "\MPE All Duplicates.xlsx"
Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter
}
@ -199,6 +201,7 @@ $sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
if ($sql_result) {
$OutFile = $OutputFolder + "\MPE Non-Duplicates - Parent Folders.xlsx"
Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter
}
@ -211,6 +214,7 @@ $sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
if ($sql_result) {
$OutFile = $OutputFolder + "\MPE Non-Duplicates - Project Folders.xlsx"
Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter
}
@ -218,10 +222,12 @@ if ($sql_result) {
## Generate Egnyte Data Inventory Sheet
$OutFile = $OutputFolder + "\MPE Data Inventory " + (Get-Date -Format FileDateTime).DateTime + ".xlsx"
Remove-Item -Path $OutFile -Force
$SQLFile_to_Run = $PSScriptRoot + '\Generate Egnyte Export.sql'
$EgnyteExport = Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run
if ($EgnyteExport) {
$OutFile = Export-Excel -Path $OutputFile -AutoFilter
}