Deleting entire database THROUGH JAVA PROGRAM

Graph details: ~800Mil nodes, ~650Mil relationships, ~1.45Bil properties
Community Edition


  1. No permissions to stop and restart DB
  2. Entire db must be cleared out so neo4j-admin import tool can be used to import new data on a weekly basis
  3. No backup of old DB required
  4. Running Java program with quartz scheduler on a weekly basis, so trying to achieve this full deletion programmatically (writing java code to do the entire process for me: clear old db, import new db, etc). Hence, I would NOT like to be writing cypher queries through graph UI to clear nodes out in that way.

Are there suggestions for a fast, efficient way to do this?

  1. neo4j-admin import needs an non-existing or empty directory
  2. it can not work while the db is still running
  3. you have to:
  • stop the db
  • delete the directory on disk, e.g. FileUtils.deleteRecursively(file)
  • run neo4j-admin import
  • start the db

It doesn't help to delete the db with Cypher if you want to use neo4j-admin import

The directory has to be gone or be empty and that can only happed with database shutdown/restart.