ldapdelete -> solved

Mike Starke plug-discuss@lists.plug.phoenix.az.us
Sat, 14 Jun 2003 10:08:09 -0500


On Fri, Jun 13, 2003 at 08:48:24PM -0700, Bryce C wrote:
/_Have you tried
/_ldapdelete -x -W -D <bind dn> "dn=*,ou=Addressbook,dc=mydomain,dc=com"
/_Admittedly, I haven't deleted stuff from LDAP for a long time so I may
/_be wrong but I know that everythings stored by its DN and if you delete
/_everyone's DNs, they don't exist either.
/_
Nope that did not work.

This, however, did work. It is ugly, but it is a one-liner that works.
Here is the format:

ldapsearch -D "bind dn" -w "passwd" -x -b "tree to begin at" -LLL dn \
| grep cn | sed -e 's/dn:\ //g | ldapdelete -x -w "passwd" -D "bind dn"

Since I am greping and seding, I am pretty sure the -LLL can be removed,
but it is nice to already have it there while testing.

-mike