I have been putting together an application using Quartz to run several indexing jobs in sequence using SolrJ and Tomcat on Windows. I would like the Quartz job to do the following:
1. Delete index directories from the cores so each indexing job starts fresh with empty indexes to populate. 2. Start the Tomcat server. 3. Run the indexing job. 4. Stop the Tomcat server. 5. Copy the index directories to an archive. Steps 2-5 work fine, but I haven't been able to find a way to delete the index directories from within Java. I also can't delete them from a Windows command shell window: I get an error message that says "Access is denied". The reason for this is that the index directories and files have the owner "BUILTIN\Administrators". Although I am an administrator on this machine, the fact that these files have a different owner means that I can only delete them in a Windows command shell window if I start it with "Run as administrator". I spent a bunch of time today trying every Java function and Windows shell command I could find that would let me change the owner of these files, grant my user account the capability to delete the files, etc. Nothing I tried worked, likely because along with not having permission to delete the files, I also don't have permission to give myself permission to delete the files. At a certain point I stopped wondering how to change the files owner or permissions and started wondering why the files have "BUILTIN\Administrators" as owner, and the permissions associated with that owner, in the first place. Is there somewhere in the Solr or Tomcat configuration files, or in the SolrJ code, where I can set who the owner of files written to the index directories should be? Thanks, Mike