2つのファイルがそこにコピーされるように、ユーザーがフォルダーを選択できるようにこのコードを作成しました。コードは次のとおりです。
string sourcePath = @"C:\Documents and Settings\akib\";
string fileName1 = @"untitled.jpg";
string fileName2 = @"Copyuntitled.jpg";
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
var destinationFolderName = folderBrowserDialog1.SelectedPath;
if (Directory.Exists(destinationFolderName))
{
File.Copy(sourcePath + "/" + fileName1, destinationFolderName
+ "/" + fileName1);
File.Copy(sourcePath + "/" + fileName2, destinationFolderName
+ "/" + fileName2);
}
}
しかし今、私はそれを逆転させたいと思います。つまり、ユーザーがある場所に2つのファイルがある場合、それをにコピーしますc:\programfiles\myfolder
。それでFolderBrowseDialog
、そのような場合に使用できますか?はいの場合、どのように?