title: How do I label new files on a branch using cleartool?
body: <p>To provide some context, I am trying to write a script which will take a text file with clearcase elements in it, and label all of those elements.</p>
  
  <p>To generate the text file, I am basically using the following command:</p>
  
  <pre><code>cleartool find -a -nxn -ele "brtype(branchName)" -print &gt; "textfile.txt"
  </code></pre>
  
  <p>Then I go through the text file and remove the elements I don't want to label. The last step would be to feed the text file into a script which would repeatedly call a cleartool command on each line of the file.</p>
  
  <p>For all existing files/folders, I can run this command:</p>
  
  <pre><code>cleartool mklabel -rep "label_name" (element_path)
  </code></pre>
  
  <p>Where I run into trouble is with files that have been added to the branch. They print out to the text file in a format that isn't recognized by the "mklabel" command and I can't find a good way to parse them.</p>
  
  <p>The format of the files is similar to the following:</p>
  
  <pre><code>\original_folder_path@@\branch_name\version_number\new_sub_folder_path\branch_name\version_number\file_name.java
  </code></pre>
  
  <p>In the past I have used this generic command we use at my company to blindly label all files in a branch:</p>
  
  <pre><code>cleartool find -all -branch "brtype(&lt;branch&gt;)" -version "version(.../&lt;branch&gt;/LATEST) &amp;&amp; !version(.../&lt;branch&gt;/0)" -visible -exec "cleartool mklabel -rep &lt;label_name&gt; %CLEARCASE_XPN%"
  </code></pre>
  
  <p>But I only want to label about half the files on the branch I am using, and there are too many to label them individually. I am sure I am missing something obvious here. Does anyone know how I should change my find or mklabel command to accommodate the new files and folders?</p>