Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8968099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:23:41+00:00 2026-06-15T17:23:41+00:00

I have a form with a File Watcher to which he transfers to multiple

  • 0

I have a form with a File Watcher to which he transfers to multiple addresses all video files placed in a folder. What is the best option so that when multiple files are added to even be able to perform each transfer in a thread. Here’s an example of my code:

DockingBarTransferEntities context = new DockingBarTransferEntities();

private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
        {
            IEnumerable<Diretorios> directories = context.Diretorios.ToList();            

            foreach (var destino in directories)
            {
                try
                {
                   Transfere(e.FullPath,Path.GetFileName(e.FullPath),destino);

                }
                catch (Exception ex)
                {
                    textBox1.Text += "Error: " + ex.Message;
                }
            }
        }

        public void Transfere(string fullPath, string name, Diretorios diretorio)
        {           
            try
            {
                if (Directory.Exists(diretorio.Caminho))
                {
                    string fileName = Path.GetFileName(fullPath);
                    fileName = String.Format("{0}\\{1}", diretorio.Caminho, fileName);

                    FileInfo arquivo = new FileInfo(fullPath);

                    arquivo.CopyTo(fileName, true);                  

                }
            }
            catch (Exception ex)
            {

            }
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:23:42+00:00Added an answer on June 15, 2026 at 5:23 pm

    It should be as simple as this:

    Task.Factory.StartNew(() => Transfere(e.FullPath, Path.GetFileName(e.FullPath), destino));
    

    instead of calling Transfere directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an form which will send some data to an php file ,
I have form with file upload. The files to be uploaded actually are pictures
I have some web-form which posts some data and user file to first php
I have form with many input fields plus primefaces component to upload multiple file
I have a form with 10 file inputs. They can contain 10 random files
I currently have a form with multiple file inputs: Resume: <input type=file id=resume name
I have one windows form file that each time I open it in Visual
Is it possible to reload a form after 'file-input' change? I have a form
I need to read test.TXT file(tab delimited) into MATLAB. TXT file have form: Datum
I have file with name contact.php, inside I have form: <form method=post name=kontakt action=send_mail.php>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.