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