So kopieren Sie eine Datei in C#
Frage
Ich möchte eine Datei in C# von A nach B kopieren.Wie mache ich das?
Lösung
Die File.Copy-Methode:
Andere Tipps
Ohne Fehlerbehandlungscode:
File.Copy(path, path2);
Verwenden Sie die FileInfo-Klasse.
FileInfo fi = new FileInfo("a.txt");
fi.CopyTo("b.txt");
System.IO.File.Copy
Das sollte funktionieren!
using System.IO;
...
var path = //your current filePath
var outputPath = //the directory where you want your (.txt) file
File.Copy(path,outputPath);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow