I'm trying to delete over a hundred objects in my LDAP tree with the
command line tool ldapdelete. So far, I've just used this tool to delete
one specific item at a time. I thought I could also use it to delete
many items based on a filter, but now I'm not sure and would like some
guidance.

I have many object in a tree with "ou=ccpperson,dc=jhuccp,dc=org". One
of the attributes of ccpperson is ccpField, with either a value "T" or
"F". I'd like to delete all ccpperson entries with ccpField=F. Is this
possible to do in one command with ldapdelete?

If not, I think I need to use ldapsearch to find all the ccpField=F and
make them into a file of just DNs. I saw the -LLL option to ldapsearch,
but the output of this command looks like:

[EMAIL PROTECTED]:/var/www/centernet/htdocs/ldap_auth$ ldapsearch -x -b
"ou=ccpperson, dc=jhuccp, dc=org" "cn=E. Kevin Zembower" -LLL dn
dn: cn=E. Kevin Zembower,ou=ccpperson,dc=jhuccp,dc=org

[EMAIL PROTECTED]:/var/www/centernet/htdocs/ldap_auth$ ldapsearch -x -b
"ou=ccpperson, dc=jhuccp, dc=org" "cn=E. Kevin Zembower" -LLL dn
>dn2remove 
[EMAIL PROTECTED]:/var/www/centernet/htdocs/ldap_auth$ ldapdelete -x -D
'cn=admin, dc=jhuccp, dc=org' -w BwiIwbf -v -f dn2remove 
ldap_initialize( <DEFAULT> )
deleting entry "dn: cn=E. Kevin Zembower,ou=ccpperson,dc=jhuccp,dc=org"
ldap_delete: Invalid DN syntax (34)
        additional info: invalid DN
[EMAIL PROTECTED]:/var/www/centernet/htdocs/ldap_auth$

Is there any way (short of shell manipulations) to format the output of
ldapsearch so that it can be fed right into ldapdelete? And then, is it
possible to just pipe the output of ldapsearch into ldapdelete without
writing an intermediate file to disk?

Thanks in advance for your advice and suggestions. My system is
OpenLDAP.

-Kevin

Kevin Zembower
Internet Services Group manager
Center for Communication Programs
Bloomberg School of Public Health
Johns Hopkins University
111 Market Place, Suite 310
Baltimore, Maryland  21202
410-659-6139 

---
You are currently subscribed to ldap@umich.edu as: [EMAIL PROTECTED]
To unsubscribe send email to [EMAIL PROTECTED] with the word UNSUBSCRIBE as the 
SUBJECT of the message.

Reply via email to