Share your content and reach out to more developers by submitting them at Abundantcode.com - Developer Community Site

How to Check if a file exists in Windows Storage in UWP ?

Do you want to know if a file exists in the Windows Storage from your Universal Windows Platform (UWP) app ?. Below is a sample code snippet demonstrating how to do it.

How to Check if a file exists in Windows Storage in UWP ?

Windows.Storage.StorageFolder Location = 
     Windows.ApplicationModel.Package.Current.InstalledLocation;
var lstfiles = await Location.GetFilesAsync(CommonFileQuery.OrderByName);
var foundfile = lstfiles.FirstOrDefault(x => x.Name == "abunndantcodeImage");
if foundfile != null)
{
   // File found , perform the logic
}
Tags :

Leave Your Comment