Domanda
Voglio copiare un file da A a B in C#.Come lo faccio?
Soluzione
Il metodo File.Copy:
Altri suggerimenti
Senza alcun codice di gestione degli errori:
File.Copy(path, path2);
Utilizza la classe FileInfo.
FileInfo fi = new FileInfo("a.txt");
fi.CopyTo("b.txt");
System.IO.File.Copia
Dovrebbe funzionare!
using System.IO;
...
var path = //your current filePath
var outputPath = //the directory where you want your (.txt) file
File.Copy(path,outputPath);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow