且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

命令行删除所有ClearCase视图专用文件

更新时间:2023-12-05 18:11:34

几句话:


  • ct lsprivate 非常适合动态视图,而非快照视图

  • ct ls -rec -view_only 以及 ct lsprivate 也列出您的签出文件...我不确定您要删除这些...

  • ct lsprivate is great for dynamic views, not snapshot views
  • ct ls -rec -view_only as well as ct lsprivate also list your checked-out files... I am not sure you want to delete those...

对于列出私人文件(只有私人文件,而不是被劫持的文件,你可能想保留),你需要一个命令:

For listing private files (only private ones, not hijacked ones you may want to keep), you need to have a command that:


  • 会考虑名称中的空格

  • 不列出签出或劫持或删除的文件或符号链接

  • 适用于快照和动态视图

  • (奖励)不依赖于外部Shell命令

  • takes into account spaces in name
  • does not list checkouts or hijacked or eclipsed files or symlinks
  • works for both snapshot and dynamic views
  • (bonus) does not depend on external shell commands

for / Fusebackq delims =%i in(`cleartool ls -r ^ |查找/ V规则:^ | find / Vhijacked^ | find / Veclipsed^ | find / V - >`)do @echo%i

以纯Windows方式(不需要外部shell依赖)列出所有私有文件(跳过劫持/ eclipsed /签出或非私有文件以及符号链接)。

替换 @echo%i del / F%i b请注意%i周围的双引号,以便正确显示/删除其名称中带有空格的文件。
还要注意没有cleartool参数-nxn,因为符号链接将无法区分,并且视图私有文件不会被装饰。

That lists all your private files (skipping the hijacked/eclipsed/checked-out or non-private ones as well as symlinks) in a pure Windows way (no external shell dependency needed).
Replace @echo "%i" by del /F "%i" and they are gone.
Note the double quotes around %i, in order to display/remove properly files with spaces in their name. Also note the absence of the cleartool parameter -nxn, as symlinks would otherwise be indistinguishable and view-private files are not being decorated anyway.

为了也删除私有目录,首先使用 rmdir / S / Q%i运行命令,然后使用 del / F%i

In order to also get rid of private directories, first run the command with rmdir /S /Q "%i" and then with del /F "%i".