Alex Rivera | Logout

How can I get the size of a folder on SD card in Android?

Asked 2010-10-28T08:08:50.350
35

Is it possible to easily get the size of a folder on the SD card? I use a folder for caching of images, and would like to present the total size of all cached images. Is there a way to this other than iterating over each file? They all reside inside the same folder?

Edit
Report

1 Answer

0

Iterating through all files is less than 5 lines of code and the only reasonable way to do this. If you want to get ugly you could also run a system command (Runtime.getRuntime().exec("du");) and catch the output ;)

answered 2010-10-28T08:15:18.147

Your Answer