I have tons of xxx.cmd
files that sit in multiple folders (e.g. child1
, child2
, child3
, etc), they have a parent folder parent
Is there a cleartool command that I can executes on the parent
folder that deletes all the .cmd
files in all children folders?
Not easily, because you need to checkout any parent directory including those files, before doing the cleartool rmname
.
The easiest would be to:
For all source-name arguments that are directories, performs an rmname
operation on elements that are already in the VOB but are not present in the source directory.
If used in combination with -recurse
, performs this rmname
operation in all directories traversed.
If used in combination with -downcase
, performs the downcase
operation before looking for matching names in the VOB.
I had the same need today and was not very happy with the proposition of using clearfsimport
because of the need to make a local copy. This what I have done in a bash environment (msys under windows for me):
- List all files to delete using
find
:
find parent -name "*.cmd" | tee to_remove_list.txt
- Extract a list of folders:
sort to_remove_list.txt | xargs -i dirname {} | uniq | tee to_checkout.txt
- Check-out all those folders:
cat to_checkout.txt | xargs -i cleartool co -nc {}
- Remove the files:
cat to_remove_list.txt | xargs -i cleartool rm {}
- Check-in all folders:
cat to_checkout.txt | xargs -i cleartool ci -nc {}
- (Optional) clean-up the folders and file lists:
rm to_remove_list.txt to_checkout.txt