5

Using the ClearCase find command, how do I find all files in a directory that do not have the name pom.xml?

I'd like to pass other selection options to the ClearCase find command so I'd prefer not to execute another command.

I am using a RedHat linux version of ClearCase. I have tried "cleartool find ! -name pom.xml -print" and that does not work.

PS: I do not use ClearCase by choice, it's mandated on my project. This is one of the reasons I hate it. I've read the man pages several times and see no clear way to do this that works!

Ishmaeel
  • 14,138
  • 9
  • 71
  • 83
John in MD
  • 2,141
  • 5
  • 25
  • 36

3 Answers3

3

ClearCase wildcards doesn't have inversion (AFAIR) but you can use grep for this -

cleartool ls -short -nxname | grep -v pom.xml
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Dmitry Khalatov
  • 4,313
  • 3
  • 33
  • 39
3

There is another solution which might work for you. Try

ccapply task

Pulak Agrawal
  • 2,481
  • 4
  • 25
  • 49
2

You seem to forget the -exec option of the cleartool find command.

It actually does allow you to execute other commands than cleartool ones, including system ones (like a sh or DOS script).

I know you would "prefer not to execute another command", but if that other system script is part of the exec option of a find command... it can be argued it is still one command ;)

So create a simple script like:

(Unix 'print.sh')

#!/bin/sh
if [ $1 != $2 ] ; then
  echo $1
fi

(windows 'print.bat')

@echo off
if not "%1"=="%2" echo "%1" 

Put that script either in your search directory, or add the script path to your %PATH% or $PATH environment.

And finally, use the find command (with all the other options regarding date filtering, branch filtering and so on)

(Unix)

cleartool find . -nrec -type f -exec './print.sh $CLEARCASE_PN ./pom.xml'

(windows)

cleartool find . -nrec -type f -exec "print.bat %CLEARCASE_PN% .\pom.xml"

And here you go: "all files in a directory that do not have the name pom.xml".

Note: the '-type f' option of the find command allows you to restrict the search to file names only (not directory names).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • That's fine, except for cases when we're talking about cleartool evaluating thousands of files (in my case, tens of thousands) of files withing a certain directory. I want cleartool to not even look at a particular directory. If I have it evaluate everything and then omit it later with another command, after cleartool is done searching everything, it will take a lot longer to complete. – searchengine27 Mar 03 '16 at 16:51