Somebody has to (I believe) "own" the folder even if it was shared.
So if you are the original owner of the folder and then shared it, unfortunately I don't think you can
One solution I had to a similar issue is I signed up for a new Google Apps account (back when they were free - I am sure a regular GMail account will do just fine) and then shared the folders with that user.
I then created a new folder with my dummy GMail account, and created a similar folder structure in that account, and copied all the files there. It was fast and I think it basically didn't actually copy the files.
I then (held my breath....) and deleted the original folder from my normal GMail account and shared the folder with myself from the dummy account.
It's a bit of an odd solution, but I think the reason is Google wants to make sure there is someone whose account has the files and folders associated with it
UPD: as Google started to block unverified scripts, the only way to use it is copy-paste the source to your script editor. And verification requires some extra effort, so I didn't do it yet.
UPD2: if you have a lot of files it will reach the execution time limit and stop; you will need to run it multiple times (you can also set up automatic timed trigger for this)
I wrote a simple script for this. You can run it from here: https://script.google.com/macros/s/AKfycbyUvNoXzBMBDE9pnHkLUltliGwjip5x09t3PeTY_1KoXO45F6iz/exec
(if it gets stopped, just run it once again, and it will continue from where it left)
It will create two files in the root of your Drive, one displays progress and is deleted after script is completed. Other is the report which lists all folders and sizes. It looks like this.![Google Drive folder sizes report](https://i.stack.imgur.com/oSwL6.png)
Or you can just copy and paste the code into Google Script editor and run "doGet()" function from there:
function doGet(){
var progressFileCompletedFound = DriveApp.getRootFolder().searchFiles("title contains 'Folder Sizes Report Completed'");
if(progressFileCompletedFound.hasNext()) {
return ContentService.createTextOutput("Report file was already created in your Drive's root folder, exiting.");
}
CreateReportFile();
DriveApp.createFile("Folder Sizes Report Completed.txt", "You may safely delete this file.");
return ContentService.createTextOutput("Report file created in your Drive's root folder");
}
function CreateReportFile() {
var reportContent = CreateReport();
DriveApp.createFile('Folder Sizes Report.txt', reportContent);
}
function CreateReport(){
var reportContent = "";
var progressFileFound = DriveApp.getRootFolder().searchFiles("title contains 'Getting Folder Sizes,'");
var progressFile;
var report=[];
if(progressFileFound.hasNext()) {
progressFile = progressFileFound.next();
var json = progressFile.getBlob().getDataAsString();
try{
report = JSON.parse(json);
} catch(Exception) {
DriveApp.removeFile(progressFile);
progressFile = DriveApp.createFile("Getting Folder Sizes, 0 processed...", " ");
}
}
else {
progressFile = DriveApp.createFile("Getting Folder Sizes, 0 processed...", " ");
}
var f = DriveApp.getRootFolder();
AddFolderToReport(report, f, "/", progressFile);
DriveApp.removeFile(progressFile);
reportContent += "TotalSize MB FilesSize MB Path \r\n";
for(var i=0; i<report.length; i++)
reportContent += Utilities.formatString("%12.2f ", (report[i].totalSize / (1024*1024))) + Utilities.formatString("%11.2f ",(report[i].filesSize / (1024*1024))) + report[i].folderPath + "\r\n";
return reportContent;
}
function AddFolderToReport(report, currentFolder, currentPath, progressFile){
var report1 = [];
for(var i=0; i<report.length; i++)
if(report[i].folderPath == currentPath)
return report[i].totalSize;
var fChildren = currentFolder.getFolders();
var totalSize = 0;
while(fChildren.hasNext() && currentPath.length < 2000){
var nextF = fChildren.next();
totalSize += AddFolderToReport(report, nextF, currentPath + nextF.getName() + "/", progressFile);
}
var filesSize = 0;
var files = currentFolder.getFiles();
while(files.hasNext()){
filesSize += files.next().getSize();
}
totalSize += filesSize;
report.push({folderPath: currentPath, filesSize: filesSize, totalSize: totalSize});
progressFile.setName("Getting Folder Sizes, " + report.length + " processed...");
progressFile.setContent(JSON.stringify(report));
return totalSize;
}
UPD: the script was updated so that if it runs too long and is stopped, just run it once more and it will resume from where it left, using data stored in "Getting Folder Sizes ..." file.
Best Answer
Unfortunately, there are no options provided for checking folder sizes whether they are shared or not. There is a whole thread at Google Support since 2019 asking how to check (normal) folder size. However, Google has not yet implemented the feature.