Thursday, January 10, 2008

Multithreading Backup Utility in VB.NET

Multithreading Backup Utility (CodeProject)
Multithreading is something we will all have to deal with sooner or later. This relatively simple application shows you how to use two threads to copy files. You will need Framework 2.0 to run this application, and Visual Studio 2005 if you want to edit the source code.
Download demo project (MSI only, so Framework 2.0 needed) - 153.0 KB
Download source - 96.4 KB


Backup is a utility program that will copy files from one path to another using one thread to display the names of the files being copied, and another thread to count the number of files and folders at the same time the files are being copied. This means no time is wasted waiting to get the file count before the copy can start; it copies and counts at the same time using two threads.

The Backup application is also a handy utility to copy large volumes of files from one path to another quickly and efficiently. It is fast simply because it will not copy a file that is already in the destination path and has not changed (why copy a file that is already there and hasn't changed?). So it's great for repetitive backups as it only copies new or updated files.

Another added feature is that Backup will not stop copying just because it got a security error on a particular file, or any type of error for that matter (excluding a hardware failure, of course). It will simply log the error and keep going until finished. You can then review the errors in the log file afterwards, which will show the error and the file that failed to copy. Most failures are due to security configuration problems.

No comments: