Frage

Ich möchte eine Datei in C# von A nach B kopieren.Wie mache ich das?

War es hilfreich?

Lösung

Die File.Copy-Methode:

MSDN-Link

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
scroll top