Softerra LDAP Administrator HelpShow AllHide All

COPY Statement

The COPY statement is used to copy LDAP entries.

Syntax

For copying one LDAP entry

COPY entry-DN [NEWRDN new-RDN | {SET|ADD|DELETE} (attr-name=attr-value[, ...])] 
[NEWSUPERIOR new-superior-DN] [DELETEOLDRDN yes|no]

For bulk copy of entries matching the specific criteria.

COPY FROM base-DN [NEWRDN new-RDN | {SET|ADD|DELETE} (attr-name=attr-value[, ...])] 
    [NEWSUPERIOR new-superior-DN] [DELETEOLDRDN yes|no] [CLEAR_COLLECTIVE yes|no]
    [WHERE where-clause] [SCOPE search-scope] [REFERRALS true|false] [PAGESIZE size-num]

COPY keywords

KeywordDescription
COPY Defines DN of the entry, which will be copied.
FROM Defines the base-DN of the entry, starting from which the search for the entries to be copied will be run.
NEWRDN Defines the new RDN for the entry.
(SET | ADD | DELETE) Defines RDN modification operation.
SET - updates RDN of the entry.
ADD - adds a new attribute to RDN.
DELETE - deletes an attribute from RDN.
NEWSUPERIOR Defines the DN of the new superior entry under which the will be copied.
DELETEOLDRDN Defines whether to keep the original entry in the directory or to delete it. Possible values are YES and NO.
CLEAR_COLLECTIVE Defines whether to process collective attributes when copying entries or not. Possible values are YES and NO.
WHERE An optional keyword. Defines the query filter of elements to be copied. If not specified, all found entries will be processed.
SCOPE An optional keyword. Defines the search scope of entries to be copied. Can be ONELEVEL, SUBTREE, and BASE. Use ONELEVEL to search only the immediate children of the base-DN entry, SUBTREE to search the base-DN entry and all of its descendants, and BASE to search only the base-DN entry. If not defined, the scope value for the statement is SUBTREE.
REFERRALS An optional keyword used to define whether to process entries in referrals. Possible values are TRUE and FALSE. If not defined, referrals are not handled.
PAGESIZE An optional keyword used to define the number of entries to be returned per one search request. For more details refer to the Paging Overview section. If this parameter is not defined, the size-num is 200.

Examples of COPY statements

Copy entry CN=John Doe,OU=Users,DC=Company to the OU=HR Managers,DC=company.

COPY "CN=John Doe,OU=users,DC=company"
NEWSUPERIOR "OU=HR Managers,DC=company"

Copy all computers from DC=company,DC=com to the DC=computers,DC=com.

COPY FROM "DC=company,DC=com" 
NEWSUPERIOR "DC=computers,DC=com" 
WHERE $objectClass='computer' AND $department IS NOT NULL

Make copy of the CN=Computer1,CN=company object, without copying of the collective attributes.

COPY "CN=Computer1,DC=company"
NEWRDN "CN=Computer2"
CLEAR_COLLECTIVE YES

Copy user CN=Alan Miller,CN=company to the new container OU=Users,CN=company with making multi-valued RDN of the copied entry by adding the uid attribute to it's RDN.

MODDN FROM "OU=HR,DC=company" NEWSUPERIOR "OU=Sales,DC=company"
WHERE $whenCreated  > CURRENT_DATE -  interval '1 month'
    AND $objectClass="user" AND $objectCategory="Person"
SCOPE ONELEVEL