Question

Je souhaite copier un fichier de A vers B en C#.Comment je fais ça?

Était-ce utile?

La solution

La méthode File.Copy :

Lien MSDN

Autres conseils

Sans aucun code de gestion des erreurs :

File.Copy(path, path2);

Utilisez la classe FileInfo.

FileInfo fi = new FileInfo("a.txt");
fi.CopyTo("b.txt");

Système.IO.Fichier.Copie

Cela devrait fonctionner !

using System.IO;

...

var path = //your current filePath
var outputPath = //the directory where you want your (.txt) file


File.Copy(path,outputPath);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top