WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

File Operations

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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:

  1. Set up an ini file for communications

  2. There are two wbt files. COPIER.WBT and BAR.WBT

  3. 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.

  4. 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.

  5. I would prefer to yell at my users about patience.
Also take a look at the following article, also on this tech supt website:

Display a Progress Thermometer


Article ID:   W13242
Filename:   Progress Bar during FileCopy.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38