I need to create a file in the downloads folder for a UWA on Windows 10 and copy the content of an existing file into it. I use the following code:
StorageFile cleanFile = await Windows.Storage.DownloadsFolder.CreateFileAsync(cleanFileName);
await file.CopyAndReplaceAsync(cleanFile);
This works ok, but the folder the file is stored is this:
C:\Users\MyUser\Downloads\e15e6523-22b7-4188-9ccf-8a93789aa8ef_t8q2xprhyg9dt!App\WordComment-clean.docx
I assume this is some type of Isolated Storage. But really, that is not what I need. Since the user can't see the file like this.
From MSDN:
If you don't use a file picker, you are saving the file in your app folder in Downloads.
Souce
Using the Download folder
For using the download folder, the user needs to select the download folder manually.
I hope this can help you.
Try this: await file.CopyAndReplaceAsync(cleanFile); await file.RenameAsync("the name you want")