da440dil
da440dil

Reputation: 31

DocsList getSize() always returns zero

Logger.log(DocsList.getRootFolder().getFolders()[0].getSize()); //returns zero
Logger.log(DocsList.getRootFolder().getFiles()[0].getSize()); //returns zero

Any tips???

Upvotes: 1

Views: 520

Answers (2)

Serge insas
Serge insas

Reputation: 46794

AFAIK this is normal behavior ... a Google folder has no size... and the first file you get is probably a Google document (or spreadsheet) which has no size either (meaning it takes no space, only 'foreign files' take space in your drive storage).

This is clearly explained in the DRIVE UI when they tell you that you have a free 5 GB storage and how this is to be considered

Upvotes: 1

Srik
Srik

Reputation: 7957

Folder.getSize () is not a documented method. So, its hard to say what is expected as output. If you are looking to get the number of folders in the root folder, use

Logger.log(DocsList.getRootFolder().getFolders().length);

Upvotes: 0

Related Questions