I would like to describe all batch AND executable files with a cleartool command. I can do this for one type of file :
cleartool find "Z:\PATH" -name *.bat -exec "cleartool describe %%CLEARCASE_PN%%"
But I can't find any way to do it for both types of files. I could duplicate the line, but this is not a good solution because of poor performance. I have tried surrounding with single or double quotes, with pipe or double pipe, but nothing works (-name "*.bat, .exe", -name (.bat || *.exe), etc.). Is there any solution ?
Thanks
The easiest way is to find all files, and test in the exec directive if the extension if the one expected:
cleartool find "Z:\PATH" -type f -exec "myscript %%CLEARCASE_PN%%"
With myscript
a script written in the language of your choice, testing the file extension and calling cleartool describe if that extension matches.
Note the -type f
, to limit the search for the files only (not the folders).
For instance, in Perl (and calling cleartool
from Perl):
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use File::Basename;
$file=$ARGV[0];
my ($dir, $name, $ext) = fileparse($file, @exts);
if ($file ~= /bat|exe) {
system("cleartool describe $file");
}