How to delete file elements by file extension in ClearCase?

扶醉桌前 提交于 2019-12-01 11:43:37
VonC

Not easily, because you need to checkout any parent directory including those files, before doing the cleartool rmname.

The easiest would be to:

  • Copy all your elements outside the view.
  • remove all the *.cmd file (using any find utility you want, nothing to do with clearcase)
  • clearfsimport back those files into your view (minus the *.cmd files removed), with the option -rmname ("mirror clearfsimport"):

    • none of the existing files will be affected
    • the *.cmd files present in the destination (your ClearCase view), but no longer present in the source (your backup where you cleaned and removed those files), will be removed (rmnamed), with the fastidious checkout-checkin of the parent directories done for you.

    –rmname

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):

  1. List all files to delete using find:
    find parent -name "*.cmd" | tee to_remove_list.txt
  2. Extract a list of folders:
    sort to_remove_list.txt | xargs -i dirname {} | uniq | tee to_checkout.txt
  3. Check-out all those folders:
    cat to_checkout.txt | xargs -i cleartool co -nc {}
  4. Remove the files:
    cat to_remove_list.txt | xargs -i cleartool rm {}
  5. Check-in all folders:
    cat to_checkout.txt | xargs -i cleartool ci -nc {}
  6. (Optional) clean-up the folders and file lists:
    rm to_remove_list.txt to_checkout.txt
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!