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

Published on December 31, 2015 by abundantcode

Filed under Universal Windows App

Last modified December 31, 2015

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 1 (2 votes)

This article have been viewed 5293 times

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
}

Leave a Comment


x

You might be Interested in these Posts

How to delete user account from command line in Windows 10 ?

You can delete a user account from command line in Windows 10 using the net user command and specify...

How to add new user account from command line in Windows 10 ?

You can add a new user account in Windows 10 using command prompt using the net user command and pas...

How to open display settings from command line in Windows 10 ?

The display properties can be found in the settings app in Windows 10 which lets the users to config...