To generate a file of distinguished names (DNs) to delete from the Directory Server:

  1. To search for all entries in a branch and return the DNs of the subentries, run the following command.

    For this example, the search is for all entries in the ou=Accounting branch.

    $ bin/dump-dns -D "cn=admin,dc=example,dc=com" -w password --baseDN \
                            "ou=Accounting,ou=People,dc=example,dc=com" --outputFile /usr/local/entry_dns.txt
  2. Run the ldapdelete command with the file to delete the entries.

    The following command uses the --continueOnError option, which continues deleting through the whole list even if an error is encountered for a DN entry.

    $ bin/ldapdelete --filename /usr/local/entry_dns.txt --continueOnError