Fast Search to see if a String Exists in Large Files with Delphi

前端 未结 6 1870
抹茶落季
抹茶落季 2020-12-14 13:31

I have a FindFile routine in my program which will list files, but if the \"Containing Text\" field is filled in, then it should only list files containing that text.

<
6条回答
  •  臣服心动
    2020-12-14 14:02

    It depends on what kind of data yre you going to search with it, in order for you to achieve a real efficient results you will need to let your programm parse the interesting directories including all files in there, and keep the data in a database which you can access each time for a specific word in a specific list of files which can be generated up to the searching path. A Database statement can provide you results in milliseconds.

    The Issue is that you will have to let it run and parse all files after the installation, which may take even more than 1 hour up to the amount of data you wish to parse.

    This Database should be updated eachtime your programm starts, this can be done by comparing the MD5-Value of each file if it was changed, so you dont have to parse all your files each time.

    If this way of working can be interesting if you have all your data in a constant place and you analyse data in the same files more than each time totally new files, some code analyser work like this and they are real efficient. So you invest some time on parsing and saving intresting data and you can jump to the exact place where a searching word appears and provide a list of all places it appears on in a very short time.

提交回复
热议问题