Question

I have a folder called AllPage. It has a number of png files. I m trying to retrieve the names of all the files from the folder using GetFilesAsync and apparently it retrieves nothing! :(

This is how I tried

        IStorageFolder dataFolder = await local.CreateFolderAsync("AllPage", CreationCollisionOption.OpenIfExists);

EDIT

        var obj = await dataFolder.GetFilesAsync();
        var temp = obj[0];
        var temp1 = obj[1];            
        return true;

obj gives me COM component. :( I'm so confused.

Was it helpful?

Solution

This is how I retrieved the file names :)

        IStorageFolder dataFolder = await local.GetFolderAsync(App.ALL_PAGE_FOLDER);
        IEnumerable<IStorageFile> files = await dataFolder.GetFilesAsync();

        foreach (IStorageFile anyfile in files)
        {
            if (anyfile.Path.EndsWith(".png"))
            {
                var name = anyfile.Name;
            }
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top