how to Create a progressbar to show Copy operation Progress

S

Sachin

Hello All
I have written a program which copies huge amount of files from one location
to another.

Its written in MFC. Currently during the copy operation i show a non
deterministic progress bar which keeps floating irrespective of actual
progress of copy operation.

But now i want to to create a progress bar which will show the actual
progress

Any idea how to create such a progress bar ?

the input files tools copies may come from different root directories /
drives

Thanks in advance

Sachin
 
D

David Lowndes

I have written a program which copies huge amount of files from one location
to another.

Its written in MFC. Currently during the copy operation i show a non
deterministic progress bar which keeps floating irrespective of actual
progress of copy operation.

But now i want to to create a progress bar which will show the actual
progress

Any idea how to create such a progress bar ?

the input files tools copies may come from different root directories /
drives

Sachin,

Have you considered using SHFileOperation?

Dave
 
S

Sachin

SHFileOperation will help only when i am copying from one directory to other .
what if i have list of files to be copied from various drives / directories
and while copying i do not simply copy or move it i have to process on the
file ..

So i want to know is there any way i can quickly calculate count and size of
input files to be copied ..

say user selected
e:\input1
d:\input2

to be copied i do not know how big these folders willl be or how many files
it might contains . so time required to copy these items is unknown
but i want to show a progress bar so that user will know how many files are
involved and how long it takes ..

Can MFT ( Master File table ) help in any way ?
 
D

David Lowndes

SHFileOperation will help only when i am copying from one directory to other .

I believe it can handle any number of files/directories. The to/from
members are multiple null terminated strings.
what if i have list of files to be copied from various drives / directories
and while copying i do not simply copy or move it i have to process on the
file ..

OK, so it's not a simple "copy" operation.
So i want to know is there any way i can quickly calculate count and size of
input files to be copied ..

There's no "easy" way - you have to enumerate the files/dirs using
FindFirstFile, FindNextFile & FindClose and accumulate the sizes.

Dave
 
S

Sachin

Hi David

thanks for quick reply.

So is that the only viable option. Do you have any idea how Windows
calculates file count and size when we right click on directory . that seems
to be quite fast ..

Will using FindFirstFile / FindNextFile be that much fast ?
i was thinking if there is anything in MFT table / Registry which can help
us ?
 
D

David Lowndes

So is that the only viable option.

I believe so.
Do you have any idea how Windows
calculates file count and size when we right click on directory . that seems
to be quite fast ..
Will using FindFirstFile / FindNextFile be that much fast ?

I think the results will be similar.
i was thinking if there is anything in MFT table / Registry which can help
us ?

I'm not aware of anything.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top