lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Vincent" <n...@neoworks.com>
Subject RE: Index all the files in a directory
Date Thu, 13 Apr 2006 10:07:46 GMT
Hi Kostas,

I am assuming you need to find all of the text files in the directory.
Assuming you're using JDK1.5 you need to do something like this:

File directory = new File("c:\my\directory");
FilenameFilter findTextFiles = new FilenameFilter() {
	public boolean accept(File dir, String name)
	{
		return name.endsWith(".txt");
	}
}
for( File indexFile : directory.listFiles(findTextFiles) )
{
	...do Lucene indexing
}

If you are using JDK1.5 you can do the same using normal for loops.

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message