Progress bar during file copy
Keywords: progress bar
Question:
We have a copy routine for remote access users that tends to take a long time for certain files (up to two minutes). The users get impatient and start pounding on keys, even though nothing is wrong. How can I display a progress bar that shows the status of the entire copy operation that is not based on the number of files being copies? Maybe a bar for "this file", and a bar for "all files". Or, how can something, anything, be displayed that has motion to show these users that the copy operation is still functioning during the copy of a large file? Maybe a line of dots that grows and is reset at the beginning of each file.Answer:
Starting in version 98A of WinBatch see the functions aFileCopy and aStatusBar in the Shell Operations Extender.All our examples show a FileCopy progress bar updated in between files. Versions previous to 98a cannot update the progress bar while the script is copying a file. However, you could have a second winbatch script doing the progress bar. Could be tricky but seems doable.
Here's generally what you'd need to do:
Also take a look at the following article, also on this tech supt website:
- Set up an ini file for communications
- There are two wbt files. COPIER.WBT and BAR.WBT
- COPIER.WBT keeps track of how many total bytes to copy, and how long it has taken so far. And the number of files copies so far, and the size of the current file It writes this information to the ini file. It also copies the file.
- BAR.WBT reads the ini file, stares at the provided information computes the before and after postions of the progress bar, estimates how fast the files are being copied and advances the progress bar one seconds worth. Then it does a TimeDelay(1) and does it all again.
- I would prefer to yell at my users about patience.
Display a Progress Thermometer
Article ID: W13242Filename: Progress Bar during FileCopy.txt