In my UWP application I am trying to count and list all the files in a directory. The code looks like the following.
private async void SetUpDemo()
{
StorageFolder appInstalledFolder = Package.Current.InstalledLocation;
StorageFolder assets = await appInstalledFolder.GetFolderAsync(@"Assets\AppTestStuff");
IReadOnlyList<StorageFile> files = await assets.GetFilesAsync();
Debug.WriteLine("File Count: " + files.Count);
foreach(StorageFile file in files)
{
Debug.WriteLine(file.Name);
}
}
And Assets\AppTestStuff
looks like the following.
However, the output from this code is the following.
File Count: 2
2017-12-04 20.38.29-2.jpg
Test Text Doc.txt
I was expecting a output that looked a bit more like the following.
File Count: 6
[The 6 files from the photo]
What is causing this discrepancy and how can it be resolved?