Вопрос

I want to traverse few folders (which have subfolders and files in that) to search some word in the file and want to get line number, last modified date as result.

Which is the better and efficient way to do it using java or batch/shell scripting?

I know, using java is easier option but I want faster result.

Это было полезно?

Решение

Performance on something like this is probably much more related to the factors of how many files you are scanning and how big they are as you search through them. Each has multiple ways of achieving the same result (for example, in a batch file you normally don't search text directly but instead call out to a command line find or grep - which command you call and how you call it would affect performance markedly.)

So rather than concerning yourself with what is the fastest approach, pick whichever way makes more sense to you (easier for you to understand and work with in the context of whatever it is you are doing) and then optimize it until it's sufficiently fast for your needs.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top