You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 18, 2019. It is now read-only.
I am trying to find out how to display the total size of a specific folder. When I do $dropbox->metaData('Folder Name') the result always shows [bytes] => 0 and [size] => 0 bytes even when there are files inside the folder.
Is there a way to get the folder size or is this a bug with Dropbox?
The text was updated successfully, but these errors were encountered:
For future reference; I Came up with this code which adds up the sizes of all the files inside a folder to find out the size of the folder:
function mx_check_dropbox_size( $folder ) { global $dropbox; $foldersize = 0; $foldercontents = $dropbox -> metaData( $folder ); foreach( $foldercontents["body"] -> contents as $file ) { $foldersize += $file -> size; } if ( $foldersize == 0 ) echo '✘'; if ( $foldersize >= 20 ) echo '✔'; };
mx_check_dropbox_size( "Test/Folder" );
(The check for the foldersize and echo of the checkmark or cross is something I need for my app so you can ignore that)
The page that needs this code is going to call the mx_check_dropbox_size function about a hundred times, so I might run into some performance issues. This is why I would much rather get the folder size from the array that Dropbox is sending.
Dropbox will always return 0 bytes for a directory as described here. It's a shame because to get the size of a folder, including files and folders within, you have to make several API calls. You could contact Dropbox regarding this issue but it is not something I can address, unfortunately.
Hi Ben, thanks for your reply. I have contacted Dropbox about this and their response was that my feedback would be passed on. Not sure if this means that they will actually do something about it :)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am trying to find out how to display the total size of a specific folder. When I do
$dropbox->metaData('Folder Name')the result always shows[bytes] => 0and[size] => 0 byteseven when there are files inside the folder.Is there a way to get the folder size or is this a bug with Dropbox?
The text was updated successfully, but these errors were encountered: