stupid code formatter

This commit is contained in:
Erik Eckert 2023-09-15 14:07:21 -06:00
parent 56afe487cc
commit 5e9b6e761f
2 changed files with 15 additions and 14 deletions

View File

@ -1,8 +1,10 @@
-- Generate Non-Duplicated PARENT FOLDER List -- Generate Non-Duplicated PARENT FOLDER List
DROP TABLE DataInventory; DROP TABLE DataInventory;
CREATE TABLE DataInventory AS CREATE TABLE DataInventory AS
Select * from ( Select *
SELECT SERVER,Parent, from (
SELECT SERVER,
Parent,
REPLACE( REPLACE(
Parent, Parent,
"X:\","\\mpe.ca\datadrive\") AS UNCPath, "X:\","\\mpe.ca\datadrive\") AS UNCPath,
@ -32,4 +34,3 @@ where Parent in (
HAVING count(*) > 1 HAVING count(*) > 1
) )
and Source = 'Project'; and Source = 'Project';

View File

@ -101,7 +101,7 @@ $OfficeList | ForEach-Object -parallel {
} }
elseif ($result.Length -ge 5) { elseif ($result.Length -ge 5) {
$Server = $_.FullName.Substring(1, 4) -replace (':|\\', '') $Server = $_.FullName.Substring(1, 4) -replace (':|\\', '')
$Path = $_.FullName $Path = $_.FullName.Replace("'", "''") #SQL Formatted Path
$projectnumber = $result.tostring() $projectnumber = $result.tostring()
$DBConnect = New-SqliteConnection -DataSource $PathToDB_Copy $DBConnect = New-SqliteConnection -DataSource $PathToDB_Copy
$Query = "Select Project FROM FolderData where Project = '$ProjectNumber' AND Server = '$Server' AND Path = '$Path';" $Query = "Select Project FROM FolderData where Project = '$ProjectNumber' AND Server = '$Server' AND Path = '$Path';"
@ -119,7 +119,7 @@ $OfficeList | ForEach-Object -parallel {
$result3 = [Regex]::Matches($_.FullName, "^(.*[\\\/])") # This gets everything up the last slash, thus the "parent" $result3 = [Regex]::Matches($_.FullName, "^(.*[\\\/])") # This gets everything up the last slash, thus the "parent"
$FolderPath_Data = Get-ChildItem -Path $_.FullName -File -Depth 50 -Recurse $FolderPath_Data = Get-ChildItem -Path $_.FullName -File -Depth 50 -Recurse
$folder_Parent = $result3.value $folder_Parent = $result3.value.replace("'", "''") #SQL Formatting
$folder_FileSize = ($FolderPath_Data | Measure -sum Length).sum / 1024 / 1024 / 1024 $folder_FileSize = ($FolderPath_Data | Measure -sum Length).sum / 1024 / 1024 / 1024
$folder_FileCount = ($FolderPath_Data | measure).Count $folder_FileCount = ($FolderPath_Data | measure).Count
$folder_LastWrite = ($FolderPath_Data | measure LastWriteTime -Maximum).Maximum $folder_LastWrite = ($FolderPath_Data | measure LastWriteTime -Maximum).Maximum
@ -134,8 +134,8 @@ $OfficeList | ForEach-Object -parallel {
$out = [PSCustomObject]@{ $out = [PSCustomObject]@{
Server = $Server Server = $Server
Project = $ProjectNumber.ToString() Project = $ProjectNumber.ToString()
Parent = "'$folder_Parent'" Parent = $folder_Parent
Path = "'$Path'" Path = $Path
FileCount = $folder_FileCount FileCount = $folder_FileCount
FileSize = $folder_FileSize FileSize = $folder_FileSize
FileLastWrite = $folder_LastWrite FileLastWrite = $folder_LastWrite
@ -232,7 +232,7 @@ catch {
} }
$SQLFile_to_Run = $PSScriptRoot + '\Generate Egnyte Export.sql' $SQLFile_to_Run = $PSScriptRoot + '\Generate Egnyte Export.sql'
Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run
$EgnyteExport = Invoke-SqliteQuery -DataSource $PathToDB -Query "Select * from DataInventory" $EgnyteExport = Invoke-SqliteQuery -DataSource $PathToDB -Query "Select Server,UNCPath,EgnytePath,FileCount,FileSize,Source from DataInventory"
if ($EgnyteExport) { if ($EgnyteExport) {