すべての形式のファイル(.txt、.pdf、.doc ...)ファイルをソースフォルダーから宛先にコピーしようとしています。
テキストファイル専用のコードを書いています。
すべてのフォーマットファイルをコピーするにはどうすればよいですか?
私のコード:
string fileName = "test.txt";
string sourcePath = @"E:\test222";
string targetPath = @"E:\TestFolder";
string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
string destFile = System.IO.Path.Combine(targetPath, fileName);
ファイルをコピーするコード:
System.IO.File.Copy(sourceFile, destFile, true);