directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hendy Irawan (JIRA)" <>
Subject [jira] [Commented] (DIRSTUDIO-801) Allow sorting of LDIF files when Exporting and/or Importing
Date Tue, 22 May 2012 22:41:41 GMT


Hendy Irawan commented on DIRSTUDIO-801:

I'm not going to argue about LDAP spec, but users will appreciate when implementations make
their lives easier when possible.

As for ordering, from parent to children always works in my cases. In which particular cases
are the DN ordering not obvious?

I'm not aware how difficult it is to implement this feature in Apache LDAP libraries, but
I'll post the Ruby code to do this. Hopefully someone else will find this helpful:

#!/usr/bin/env ruby
# sudo gem install activeldap
require 'active_ldap'

ldif_data =
parsed = ActiveLdap::Ldif.parse(ldif_data)
sorted = parsed.sort_by { |entry| entry.dn.count(',') }
sorted.each { |entry|
  puts entry
(credit: )

Usage is simple:

./ldifsort.rb dc\=aksimata\,dc\=com.ldif

You can pipe or redirect the output to another file.

Granted, there are definitely cases where this simplistic tool will not work properly or use
too much memory. But at least for now, for all my use cases it's working very well, luckily
I haven't yet had an LDIF export bigger than the installed RAM :-D Hopefully someone finds
it useful too.

I still am curious about the ApacheDS Server ordering. It seems that previous ApacheDS versions
(1.5.x?) sorted the entries when the partition is indexed on objectClass, but it's not the
case in 2.0.0-M6, or perhaps I'm missing something. Shall I file another bug for this issue?
> Allow sorting of LDIF files when Exporting and/or Importing
> -----------------------------------------------------------
>                 Key: DIRSTUDIO-801
>                 URL:
>             Project: Directory Studio
>          Issue Type: Improvement
>          Components: studio-ldapbrowser
>    Affects Versions: 2.0.0-M3
>            Reporter: Jim Willeke
>            Priority: Minor
> When exporting to LDIF the entries may or may not be in the proper order for importing.
> A nice feature would be to sort the entries in a "parent-first" fashion so when importing
the Parents would always be in the file before any of the children.
> This could be done on an export or perhaps an import also.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message