Create and Delete Folder. Move the file to folder and move the file to outside of the folder

307 views Asked by At

have a gridview that contains files and folders. I would like if the user clicked the "add folder", then it will create a folder with the name of the folder the user wants. Users can also move the files into the desired folder by selecting the "move to folder" to folder the user wants (displayed menu folder names available and also menu canceled). Users can also move files that are in the folder, outside of the folder. Users can also delete folders available (if no files available in the folder).

How to apply? Is there any reference or sample to it?

1

There are 1 answers

2
Sunteen Wu On

For your required features, uwp has StorageFile and StorageFolder relevant APIs can implement. For example, create folder we can use StorageFolder.CreateFolderAsync method, delete folder we can use StorageFolder.DeleteAsync method, and for moving file we can copy the file to the destination folder firstly by StorageFile.CopyAsync method and then delete the original file by StorageFile.DeleteAsync method.

More details please reference this official document and the official sample File Access.

Pay attention that in uwp files have limited access permission. By the default the app can only access the application install directory and data locations. Additional locations require special capabilities. More details about file access permission please reference this document.