IBM Support

Command line add to Source control of a directory with files in a dynamic view returns Error

Troubleshooting


Problem

This technote explains why the error, Error: Can't create directory element because "" already exists, occurs when trying to create a new directory element from the command line in an IBM® Rational® ClearCase® VOB.

Symptom


Attempts to create a new directory element in a VOB from the command line interface (CLI) results in the error:


cleartool> mkelem -eltype directory dir1
cleartool: Error: Can't create directory element because "dir1" already exists.

Cause


A view private directory of this name already exists in the parent directory. The cleartool mkelem -eltype directory command is only used when the directory does not already exist.

Resolving The Problem


Here are the methods for adding a new directory element to a VOB from CLI:

  1. cleartool mkdir
  2. cleartool mkelem -eltype directory
  3. cleartool mkelem -mkpath

Note: Specifying –eltype directory is equivalent to using the cleartool mkdir command.

The first 2 commands require that the new directory name not already exist. If the name is already in use, then the above error is reported.

To successfully create a new directory element from command line where the name already exists, use option 3:

Example:

M:\dynamic_view\test>cleartool ls
dir1
lost+found@@\main\0                       Rule: \main\LATEST

M:\dynamic_view\test>cleartool mkelem -eltype directory dir1
cleartool: Error: Can't create directory element because "dir1" already exists.

M:\dynamic_view\test>cleartool mkelem -mkpath dir1
Creation comments for "dir1":
.
Created directory element "dir1".
Created element "dir1" (type "directory").
Checked out "dir1" from version "\main\0".

M:\dynamic_view\test>cleartool ls
dir1@@\main\CHECKEDOUT from \main\0      Rule: CHECKEDOUT
lost+found@@\main\0                      Rule: \main\LATEST


For more information on the cleartool mkdir or mkelem commands, refer to IBM Rational ClearCase Command Reference, or run cleartool man mkdir or cleartool man mkelem from CLI.

Internal Use Only




Hi, can we please update the title to CMD-Line ADD to Source of a directory with files in a Dynamic View returns Error.

The way it is handled, differs from Snapshot Views, where
Cleartool co -nc -<the parent path>
Cleartool mkdir -nc -<the dir path>
does create the directory element and subsequently the elements can be added.
Using a Dynamic View will cause an error message using the above mentioned cmds.
This is not clear from the GUI add2src, which uses mkelem -mkpath for dynamic Views.

The version information should also be updated to contain the latest versions

Thanks, Jurgen Jan 19, 2012

[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"Cleartool","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0;7.0.1;7.1;7.1.1;7.1.2;8.0","Edition":""},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"Cleartool","Platform":[{"code":"","label":""}],"Version":"","Edition":""}]

Document Information

Modified date:
16 June 2018

UID

swg21237733