//获取表示指定文件系统路径中的文件夹的 StorageFolder。 StorageFolder folder1 = await StorageFolder.GetFolderFromPathAsync(@"H:\myfolder\"); //获取 StorageFile 对象以代表指定路径中的文件。 StorageFile file1 = await StorageFile.GetFileFromPathAsync(@"H:\myfolder\myfile.txt"); //文件命名是否有效 bool isValid = StorageFileHelper.IsFileNameValid(@"myfile234.txt"); // 查询文件夹下所有 .txt 文件(递归子目录/子目录/....) QueryOptions queryOptions = new QueryOptions(); queryOptions.FileTypeFilter.Add(".txt"); queryOptions.FolderDepth = FolderDepth.Deep;//递归子目录 StorageFileQueryResult queryResult = folder1.CreateFileQueryWithOptions(queryOptions); IReadOnlyList<StorageFile> queryFileList = await queryResult.GetFilesAsync();
时间: 2024-10-23 18:33:15