If you need to do this in a script, then your script will have to recursively mkelem -mkp for the file.
(as explained in "To add elements (files and directories) to source control from the command line" and cleartool mkelem)
-mkp/ath
This option enables elements to be created within its view-private parent directories.
However, the command must be ran within a versioned parent directory.
For example, if you have a view-private file foo.c
, it's view-private parent directory dir1
, and dir1
's versioned parent directory dir2
, you must run mkelem -mkpath
in dir2
:
cleartool mkelem -nc -mkpath dir1 dir1\foo.c
By default, the element's parent directories (including those that are already elements) are checked out, as well as the element itself.
See a more complete example in this ctadd script
.
In your case:
cd m:\MyView\MyVob
cleartool mkelem -mkpath folder1\folder2\folder3 folder1\folder2\folder3\MyFile.java
An easier (non-script) solution is to:
copy folder1\folder2\folder3\MyFile.java
in m:\MyView\MyVob\
(if the folders don't exists yet, the windows command md
will create the intermediate folders in one step)
open the ClearCase Explorer and add that file to source control: it will add any missing parent folder to source control as well (or will update their content if they already exist).
See "To add files and directories to an existing directory tree (Windows)":
Right-click one of the selected objects and click Add to Source Control.
Select items that are the farthest from the root of the directory tree: the Add to Source Control command for any given file or directory also adds any parent directories (up to the VOB root directory) that are not already elements.