Simple Batch Copy Tool
Version 0.1 - Rapid Prototype
Same results as a Batch Script to copy one file to many locations. Not much UI.
Uses System.IO.File.Copy() method for copying files to destination.
There is threading so that the form still updates and functions while the copies are going.
Version 0.1 - Rapid Prototype
Same results as a Batch Script to copy one file to many locations. Not much UI.
Uses System.IO.File.Copy() method for copying files to destination.
- Basic tool operation:
- Specify the input file or directory.
- Then click "Edit Servers or %servername% and then a dialog opens where you can enter a list of servers. click OK.
- Type the common UNC path that would appear after \\%servername%\ for where the file or folder will be copied to
- Click Add and a "Copy Task" is created for each Server.
- Click Go to start processing each file.
There is threading so that the form still updates and functions while the copies are going.
Version 0.2 - UI Improvements
Improved UI significantly and added exception handling.
UI Additions:
Improved UI significantly and added exception handling.
UI Additions:
- Added the ability to remove copy Tasks (Selected, All, Completed)
- Improved Log Area to show contents more than just one line.
- Log can be saved to text file.
- UI Scales better.
Version 0.3 - Copy Speed Throttle Added
Bandwidth Throttling Added
A need arose at work to copy 33 GB of data to around 70 site servers. Each site has limited bandwidth so we can't interrupt employees by letting copy go full speed.
Throttling speed of 10 KB/s is hard coded. This was a prototype version to prove I could do it. I would not be able to complete the copy in a timely manner
The file copy progress was a mystery... the files on the remote server show 0kb until copy is complete so I had no idea how long copies were going.
Bandwidth Throttling Added
A need arose at work to copy 33 GB of data to around 70 site servers. Each site has limited bandwidth so we can't interrupt employees by letting copy go full speed.
Throttling speed of 10 KB/s is hard coded. This was a prototype version to prove I could do it. I would not be able to complete the copy in a timely manner
The file copy progress was a mystery... the files on the remote server show 0kb until copy is complete so I had no idea how long copies were going.
Version 0.4 - Added Progress bar and customizable throttle speed
Progress Bar Added
Bandwidth Throttling UI Added
Modified the way the copy tasks are stored and processed. Instead of one task per destination - multiple destinations are now stored in one task.
Added code to read the input stream buffer then write it to each multiple destination in the Copy Task.
This could have potential savings when doing large scale file copies because the disk is only being read once per source file. UI only updated partially to support this.
Also added the old System.IO.File.Copy() functionality for un-throttled copies.
Version 0.5 - Added multi-threading copy.
No UI enhancments - some poorly implemented elements (like destination shows "Collection" the Progress column isn't updated. Log is poorly implemented from the changes implemented in adding threading (can be fixed simply).
In Code added threading for the copy task.
I am reading in Bytes into my buffer then looping through all the destinations and creating a thread essentialy for each write into a destination stream.
Call a wait and then join all the threads.
Results of multi-threaded copy
I tried to compare the copy times between v 0.4 and v 0.5 but due to other activity on the network and not having a proper testing lab my results are a little skewed.
Copying a 307,142,656 byte file to 3 Remotes sites.
v 0.4 (single threaded - read once write multiple) = 38 Minutes 10 Seconds
v 0.5 (multi threaded - read once write multiple simultaneously) = 9 Minutes 51 Seconds (the throttle speed is different because I changed the wait from 1000 milliseconds to 900 milliseconds thinking that possibly the threads would not join within one second - I don't think it matters with the number of copies completed but the throttle speed will never be true unless I add a lot of logic to make it so and it will have to handle the different copy speed for each thread )
Copying a 307,142,656 byte file to only 1 Remote site
v 0.4 = 20 Minutes 48 Seconds
Reading and then sequentially writing into each destination (single threaded):
Where am I going from here...fixing UI, Making sure exceptions are handled, making sure directory copy is still functioning - It may have been broken but I have been testing with single files. Fixing the logging.
Posting code snippets - and the program.
Progress Bar Added
Bandwidth Throttling UI Added
Modified the way the copy tasks are stored and processed. Instead of one task per destination - multiple destinations are now stored in one task.
Added code to read the input stream buffer then write it to each multiple destination in the Copy Task.
This could have potential savings when doing large scale file copies because the disk is only being read once per source file. UI only updated partially to support this.
Also added the old System.IO.File.Copy() functionality for un-throttled copies.
Version 0.5 - Added multi-threading copy.
No UI enhancments - some poorly implemented elements (like destination shows "Collection" the Progress column isn't updated. Log is poorly implemented from the changes implemented in adding threading (can be fixed simply).
In Code added threading for the copy task.
I am reading in Bytes into my buffer then looping through all the destinations and creating a thread essentialy for each write into a destination stream.
Call a wait and then join all the threads.
Results of multi-threaded copy
I tried to compare the copy times between v 0.4 and v 0.5 but due to other activity on the network and not having a proper testing lab my results are a little skewed.
Copying a 307,142,656 byte file to 3 Remotes sites.
v 0.4 (single threaded - read once write multiple) = 38 Minutes 10 Seconds
v 0.5 (multi threaded - read once write multiple simultaneously) = 9 Minutes 51 Seconds (the throttle speed is different because I changed the wait from 1000 milliseconds to 900 milliseconds thinking that possibly the threads would not join within one second - I don't think it matters with the number of copies completed but the throttle speed will never be true unless I add a lot of logic to make it so and it will have to handle the different copy speed for each thread )
Copying a 307,142,656 byte file to only 1 Remote site
v 0.4 = 20 Minutes 48 Seconds
Reading and then sequentially writing into each destination (single threaded):
Where am I going from here...fixing UI, Making sure exceptions are handled, making sure directory copy is still functioning - It may have been broken but I have been testing with single files. Fixing the logging.
Posting code snippets - and the program.