[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: How to delete an entire branch of the tree?

This command will delete also the ou=myorgunit, and I just want to delete the children, is it that possible?

At 09:40 13.12.2001 +1300, you wrote:
On Wed, 12 Dec 2001, Alejandra Moreno wrote:
> I would like to know what is the ldap command that deletes all the entries
> under certain branch of the tree. For example, I tried something like:
> ldapdelete -x -D "cn=root,ou=myorgunit,o=myorg,dc=mydc" -W
> 'cn=*,ou=myorgunit,o=myorg,dc=mydc'

You need to tell it to recursively delete.
[snip from the man page for ldapdelete]

 -r     Do a recursive delete. If the DN specified isn't a
        leaf, its children, and  all  their  children  are
        deleted down the tree. No verification is done, so
        if you add this  switch, ldapdelete  will  happily
        delete large portions of your tree. Use with care.

ldapdelete -x -r -D 'cn=root,ou=myorgunit,o=myorg,dc=mydc' -W

should work and delete all the children of myorgunit.
If you are using TLS you should also add the -ZZ flag, otherwise your root
password can be sniffed.

Barry Wright

Alejandra Moreno Espinar
at rete ag

mailto:alejandra.moreno@atrete.ch, http://www.atrete.ch
snail mail: Oberdorfstrasse 2, P.O. Box 674, 8024 Zurich, Switzerland
voice: +41-1-266 55 55, direct: +41-1-266 55 91, fax: +41-1-266 55 88