logic update...
This commit is contained in:
parent
aec05f5f69
commit
8280190842
@ -1,24 +1,35 @@
|
||||
-- Generate Non-Duplicated PARENT FOLDER List
|
||||
DROP TABLE DataInventory;
|
||||
CREATE TABLE DataInventory AS
|
||||
SELECT SERVER,
|
||||
Select * from (
|
||||
SELECT SERVER,Parent,
|
||||
REPLACE(
|
||||
Parent,
|
||||
"X:\"," \\mpe.ca\datadrive\") AS UNCPath,
|
||||
REPLACE(REPLACE(Parent,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
|
||||
sum(FileCount), Sum(FileSize), 'Parent' as Source from FolderData
|
||||
Where Parent not in (
|
||||
Where Parent != (
|
||||
SELECT Parent FROM DuplicateList
|
||||
)
|
||||
GROUP by UNCPath
|
||||
)
|
||||
UNION
|
||||
SELECT SERVER,
|
||||
SELECT SERVER, Parent,
|
||||
REPLACE(PATH," X:\","\\mpe.ca\datadrive\") AS UNCPath,
|
||||
REPLACE(REPLACE(PATH,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
|
||||
sum(FileCount), Sum(FileSize), 'Project' as Source from FolderData
|
||||
Where Project not in (
|
||||
SELECT A.Project FROM NonDupProject as A)
|
||||
AND Parent not in (
|
||||
Select B.Parent FROM NonDupParent as B
|
||||
FileCount, FileSize, 'Project' as Source from FolderData
|
||||
Where FolderData.Project NOT in (
|
||||
SELECT A.Project FROM DuplicateList as A)
|
||||
AND FolderData.Parent in (
|
||||
Select B.Parent FROM DuplicateList as B
|
||||
);
|
||||
|
||||
|
||||
delete FROM DataInventory
|
||||
where Parent in (
|
||||
select Parent from DataInventory
|
||||
group by Parent
|
||||
HAVING count(*) > 1
|
||||
)
|
||||
group by Server
|
||||
ORDER BY Server;
|
||||
and Source = 'Project';
|
||||
|
||||
|
@ -221,7 +221,7 @@ if ($sql_result) {
|
||||
|
||||
## Generate Egnyte Data Inventory Sheet
|
||||
|
||||
$OutFile = $OutputFolder + "\MPE Data Inventory " + (Get-Date -Format FileDateTime) + ".xlsx"
|
||||
$OutFile = $OutputFolder + "\MPE Data Inventory " + (Get-Date -Format FileDate) + ".xlsx"
|
||||
try {
|
||||
|
||||
Remove-Item -Path $OutFile -Force -ErrorAction SilentlyContinue
|
||||
|
Loading…
Reference in New Issue
Block a user