所以我已经做到了这一点:
private async void DownloadButton_Click(object sender, RoutedEventArgs e)
{
// Pick a location to create new folder in.
FolderPicker picker = new FolderPicker { SuggestedStartLocation = PickerLocationId.Downloads };
picker.FileTypeFilter.Add("*");
StorageFolder folder = await picker.PickSingleFolderAsync();
// Create new folder with "custom name" + replaces existing.
var projectFolderName = "New Folder 2";
StorageFolder projectFolder = await folder.CreateFolderAsync(projectFolderName, CreationCollisionOption.ReplaceExisting);
//Pick a file to be copied
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/NewFolder1/File1.png"));
StorageFile file2 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/File2.png"));
//Paste copied file in custom folder.
await file.CopyAsync(projectFolder, "File1.png");
await file2.CopyAsync(projectFolder, "File2.png");
}
}
}
我不知道如何一次获取所有文件并将它们全部复制在一起。
我可以为每个文件编写新的复制/粘贴行,但必须有更简单的方法将它们放在一起。
谢谢?