Project folder size

I'd like to calculate the total disk space used by all file versions in all project folders. Here is the T-SQL query that I have so far:

select p.Path as Project

     , count(r.RevNr) as FileCount

     ,sum(r.FileSize) /1048576 as TotalMB

from documents d

     join DocumentsInProjects dip on dip.DocumentID = d.DocumentID

     join projects p on p.ProjectID = dip.ProjectID

     join revisions r on r.DocumentID=d.DocumentID

group by p.path

order by TotalMB desc

I'm thinking that this is not exactly correct since some file versions in the database to not have actual physical files in the archive folder structure.

SolidworksSolidworks Pdm/enterprise Pdm