如何在ClearCase中通过文件扩展名删除文件元素? [英] How to delete file elements by file extension in ClearCase?
问题描述
我有大量的 xxx.cmd
文件位于多个文件夹中(例如 child1
, child2
, child3
等),它们有一个父文件夹 parent
I have tons of xxx.cmd
files that sit in multiple folders (e.g. child1
, child2
, child3
, etc), they have a parent folder parent
是否有一个我可以在 parent
文件夹中执行的cleartool命令,该文件夹删除所有。所有子文件夹中的cmd
文件?
Is there a cleartool command that I can executes on the parent
folder that deletes all the .cmd
files in all children folders?
推荐答案
我今天有同样的需求,但不是很高兴由于需要制作本地副本,因此建议使用 clearfsimport
。这是我在bash环境(对我而言,在Windows下的msys)中所做的事情:
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):
- 列出所有要使用
查找
:
查找父级-name * .cmd | tee to_remove_list.txt
- 提取文件夹列表:
排序to_remove_list.txt | xargs -i目录名{} | uniq | tee to_checkout.txt
- 签出所有这些文件夹:
cat to_checkout.txt | xargs -i cleartool co -nc {}
- 删除文件:
cat to_remove_list.txt | xargs -i cleartool rm {}
- 签入所有文件夹:
cat to_checkout.txt | xargs -i cleartool ci -nc {}
- (可选)清理文件夹和文件列表:
rm to_remove_list.txt to_checkout.txt
- 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
这篇关于如何在ClearCase中通过文件扩展名删除文件元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!