Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID


We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Get progress from scanning

anggianggi Posts: 3Member
I am trying to make simple malware removal, but I dont know how to get the percentage of path that I want to scan. For example I scan c:folder, I want to get the percentage to make progress bar while scanning.

Thx a lot.


  • AtexAtex Posts: 268Member
    Let be [b]m[/b] the total number of files in a folder, [b]n[/b] the current file you process (a nonzero number) then current percentage ([b]cp[/b]) would be: [b]cp:=n*100/m[/b]
  • anggianggi Posts: 3Member
    How can I get m ? Do I have to scan twice? :(
  • AtexAtex Posts: 268Member
    : How can I get m ? Do I have to scan twice? :(

    No, you have to use the [b]findfirst[/b] and [b]findnext[/b] procedures from the [b]Dos[/b] unit to get all the filenames in a folder first. That gives you the [b]m[/b]. When you scan you'll have to open each file for scan, starting from 1 ([b]n[/b]).
  • anggianggi Posts: 3Member
    If I use findfirst or findnext, that will wasting time???
  • AtexAtex Posts: 268Member
    : If I use findfirst or findnext, that will wasting time???

    No time wasting there (takes only a fraction of a second), beside that's the only way to find out the file names from a folder...unless you read the FAT directly and process the info but that's a bit beyond plain Pascal's capability, you'd have to rely on assembly there...

Sign In or Register to comment.