Pergunta

Quero copiar um arquivo de A para B em C#.Como faço isso?

Foi útil?

Solução

O método File.Copy:

Link do MSDN

Outras dicas

Sem nenhum código de tratamento de erros:

File.Copy(path, path2);

Use a classe FileInfo.

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

System.IO.File.Copy

Isso deve funcionar!

using System.IO;

...

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


File.Copy(path,outputPath);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top