locked
Get local storage folder's size

    Question

  • I'm trying to get the size of a folder created in Windows.Storage.ApplicationData.current.localFolder.

    I've tried using "folder.getBasicPropertiesAsync" and "folder.properties.retrievePropertiesAsync(["System.Size"]) but either way it always retuns 0.

    Any ideas ?

    Wednesday, April 24, 2013 1:56 PM

Answers

  • Hi,

    I did this and got the size:

    Assumption : you already have created a folder. In my case I have created a folder with name "SampleTest"

    // Outer variable declaraion
    var folderMain = Windows.Storage.ApplicationData.current.localFolder;
    
    // Method inside any function
    
    folderMain.getFolderAsync("SampleTest").done(function (fld) {
                        fld.getBasicPropertiesAsync().done(function (prop) {
                            var size = prop.size; // You get the current size
                        });
                    });

    Hope this helps..

    - Girija

    Wednesday, April 24, 2013 10:08 PM