Reputation: 275
I am trying to delete a picture stored in my local folder in my UWP application. However, I am not very sure how to do it.
The picture file is located under "Pictures", which I think the path is:
C:\Users\UserName\Pictures
I have written a set of code which I believe is to retrieve the file... however, I am not sure how to continue from here.
StorageFolder picturesFolder = KnownFolders.PicturesLibrary;
string name = "deletetest.jpg";
StorageFile manifestFile = await picturesFolder.GetFileAsync(name);
Upvotes: 4
Views: 2358
Reputation: 788
Just add this lines.DeleteAsync will delete the file.
StorageFolder picturesFolder = KnownFolders.PicturesLibrary;
string name = "deletetest.jpg";
StorageFile manifestFile = await picturesFolder.GetFileAsync(name);
await manifestFile.DeleteAsync();
Upvotes: 9