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 9054261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:38:41+00:00 2026-06-16T13:38:41+00:00

I need you to debug my idea about this project. I’ve written a backup

  • 0

I need you to debug my idea about this project.

I’ve written a backup manager project which I give a folder and it copies every file and folder of it to another location and so on.

It works (does the copy job well) but during copying which takes about 1 minute the application UI does not respond. I’ve heard about threads and I’ve seen the word parallel programming (just the word and no more), now I want some explanation, comparison and examples to become able to switch my code.

I have done very simple actions with threads before but it was a long time ago and I am not confident enough on threading. Here is my code :

private void CopyFiles(string path, string dest)
{
    System.IO.Directory.CreateDirectory(dest + "\\" + path.Split('\\')[path.Split('\\').Count()-1]);
    dest = dest + "\\" + path.Split('\\')[path.Split('\\').Count() - 1];
    foreach (string file in System.IO.Directory.GetFiles(path))
    {
        System.IO.File.Copy(file, dest + "\\" + file.Split('\\')[file.Split('\\').Count() - 1]);
    }
    foreach (string folder in System.IO.Directory.GetDirectories(path))
    {
        CopyFiles(folder, dest);
    }
}

I run this in a timer based on a special interval, if I come up using threading, should I omit timer? Lead me, I’m confused.

  • 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-16T13:38:42+00:00Added an answer on June 16, 2026 at 1:38 pm

    Since you are not confident with threading enough, I highly recommend you read Joe Albahari’s Threading in C# Tutorial. Parallel programming is when you do multiple operations in ‘parallel’ or at the same time (mostly for spreading large amounts of calculations over several CPU or GPU cores). In this case you want threading to make your UI responsive while copying all the files. Essentially, you would have something set out like this: (After you read the threading in C# tutorial)

    Thread copyFilesThread = new Thread(() => 
    {
        CopyFiles(path, dest);
    });
    copyFilesThread.Start();
    

    The UI runs on its own thread. All of the code that is put into your application will run on the UI thread (unless you are explicitly using threading). Since your CopyFiles method takes a long time, it will stop the UI until the copying job is completed. Using threading will run the CopyFiles on a separate thread to the UI thread, therefore making the UI thread responsive.

    Edit: As for your timer, how often does it run?

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

Sidebar

Related Questions

I need to debug remote java code with IntelliJ Idea 10.5 (Ultimate Edition) When
I need to debug a class library project that is provided to the main
I need to debug scripts running on a remote server which uses an embedded
I'm developing an application for ios which uses sqlite3 I need to debug a
I have a AHK script which I need to debug. I basically want to
I need to debug my application to look for content in variables and so
I need to debug some binary crash using IDA Pro. What is the command-line
I sometimes need to debug JS in other browsers, and it would be really
I have a java class and I need to debug it (put breakpoints and
I have a very specific case that I need to debug. I need to

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.