Copy files showing progressbar

Asked

Viewed 377 times

0

Good morning.

I have a small code where I copy files from one folder to another, but as some files take time, I would like to show a progress bar, how can I do this with this following code:

        string ArquivoOrigem = System.IO.Path.Combine(CaminhoOrigem, NomeArquivo);
        string ArquivoDestino = System.IO.Path.Combine(CaminhoDestino, NomeArquivo);

        File.Copy(Path.Combine(CaminhoOrigem, ArquivoOrigem), Path.Combine(CaminhoDestino, ArquivoDestino), true);

        System.IO.File.Copy(ArquivoOrigem, ArquivoDestino, true);

1 answer

0

You can do it like this:

FileSystem.CopyFile(ArquivoOrigem, ArquivoDestino, UIOption.AllDialogs);

  • I couldn’t do it this way, I’d have something else that needs to be implemented?

  • Apparently not, which return or error is receiving?

  • The following errors appear. Error 1 The name 'Filesystem' does not exist in the Current context / Error 2 The name 'Uioption' does not exist in the Current context

  • Adds reference to: Microsoft.VisualBasic and in the code: using Microsoft.VisualBasic.FileIO;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.