private void moveInvertedFileInTemp(String invFileDir, String tempDir) throws Exception{
        // move the old inverted file in the temp directory
        System.err.println("moving the old inverted file in the temp directory...");
        File temp_f=new File(tempDir);
        if(temp_f.exists())
            if (!temp_f.delete())
                throw new Exception("Cannot delete the temporary directory. endBulkLoad failed!");

        File invFile_f=new File(invFileDir);

        if(invFile_f.exists())
            if(!invFile_f.renameTo(temp_f))
                throw new Exception("Cannot move old posting lists in the temporary directory. endBulkLoad failed!");;

        if(!invFile_f.exists())
            if(!invFile_f.mkdir())
                throw new Exception("Cannot create the directory for the new sorted posting lists. endBulkLoad failed!");;
        
    }