Search for text in windows using java -


i have directory d://../../ , inside folder there many folders , in folders there many properties files *.properties. want search particular text in properties files in d directory.how in java?

i have tried

file f = new file( "d:/code" );   file[] matchingfiles = f.listfiles( new filenamefilter() {     public boolean accept( file dir,                            string name )     {         return name.endswith( ".properties" );     } } ); 

but searching in d:/code/ not in sub folders.

you can use fileutils.listfiles apache iterate through files (not listfiles method of file, did in extended question):

https://commons.apache.org/proper/commons-io/javadocs/api-2.5/org/apache/commons/io/fileutils.html

you define iofilefilter accepts *.properties files. having list of files, read them e.g. fileutils.readlines , string.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -