FileServerDedupe/Generate Egnyte Export.sql
2023-09-15 16:19:24 -06:00

27 lines
816 B
SQL

-- Generate Non-Duplicated PARENT FOLDER List
DROP TABLE DataInventory;
CREATE TABLE DataInventory AS
Select *
from (
SELECT SERVER,
REPLACE(
Parent,
"X:\","\\mpe.ca\datadrive\") AS UNCPath,
REPLACE(REPLACE(Parent,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
sum(FileCount) as FileCount, Sum(FileSize) as FileSize, 'Parent' as Source from FolderData
Where Parent in (
SELECT Parent FROM NonDupParent
)
GROUP by UNCPath
)
union
SELECT SERVER,
REPLACE(PATH,"X:\","\\mpe.ca\datadrive\") AS UNCPath,
REPLACE(REPLACE(PATH,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
FileCount, FileSize, Project as Source from FolderData
Where FolderData.Project in (
SELECT Project FROM NonDupProject)
-- AND FolderData.Parent in (
-- Select Parent FROM NonDupParent
-- );