Didn't really find an easy way to do it but copied mostly from the Orchard framework. You will need the following:
private FileSystemStorageProvider _filesystemProvider;
private ShellSettings _settings;
And then you need to define the Site Storage Path:
var mediaPath = HostingEnvironment.IsHosted
? HostingEnvironment.MapPath("~/Media/") ?? ""
: Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media");
storagePath = Path.Combine(mediaPath, _settings.Name);
Finally, here is my function to compute the storage for a specific folder (in this case, the tenant's/site's root media folder):
public double GetSiteStorage()
{
var folders = _filesystemProvider.ListFolders(storagePath);
long totalSize = 0;
foreach (var folder in folders)
{
totalSize += folder.GetSize();
}
return (totalSize / 1024 / 1024);
}
This returns a double for the MB used. Hope this helps someone :)