You can do this with pure Java. Create a file object with the path you want, check if it exists, and it not, create it:

File newIndexDir = new File("/foo/bar")

if(!newFileDir.exists())   {

   newDirFile.mkdirs();
}

The 'mkdirs()' method creates any necessary parent directories.

If you want to automate the generation of the path itself, then there are several ways to do it, but the best way really depends on *why* you're generating a new index. For instance, you could just create a timestamped name, but that name might not be very meaningful.

Hope that helps!

-John

KK wrote:
How to create a new index? everytime I need to do so , I've to create a new
directory and put the path to that, right? how to automate the creation of
new directory?

I'm a new user of lucene. Please help me out.

Thanks,
KK.

------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.35/2123 - Release Date: 05/19/09 17:59:00



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

Reply via email to