The move-subtree tool provides the ability to move multiple entries listed in a DN file from one machine to another. Empty lines and lines beginning with the octothorpe character (#) will be ignored. Entry DNs may optionally be prefixed with dn: , but long DNs cannot be wrapped across multiple lines.

  1. Open a text file, enter a list of DNs, one DN per line, and then save the file. You can also use the ldapsearch command with the special character "1.1" to create a file containing a list of DNs that you want to move. The following example searches for all entries that match (department=Engineering) and returns only the DNs that match the criteria. The results are re-directed to an output file, test-dns.ldif:
    $ bin/ldapsearch --baseDN dc=example,dc=com \
      --searchScope sub "(department=Engineering)" "1.1" > test-dns.ldif
  2. Run the move-subtree tool with the --entryDNFile option to specify the file of DNs that will be moved from one machine to another.
    $ bin/move-subtree --sourceHost --sourcePort 389 \ 
      --sourceBindDN "uid=admin,dc=example,dc=com" --sourceBindPassword password \ 
      --targetHost --targetPort 389 \ 
      --targetBindDN "uid=admin,dc=example,dc=com" --targetBindPassword password \ 
      --entryDNFile /path/to/file/test-dns.ldif
  3. If an error occurs with one of the DNs in the file, the output message shows the error. The move-subtree tool will continuing processing the remaining DNs in the file.
    An error occurred while communicating with the target server: The entry 
    uid=user.2,ou=People,dc=example,dc=com cannot be added because an entry with that name 
    already exists
    Entry uid=user.3,ou=People,dc=example,dc=com was successfully moved from to
    Entry uid=user.4,ou=People,dc=example,dc=com was successfully moved from to