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

问题描述:

我正在寻找一个命令行来删除所有的视图专用文件和目录从Windows的ClearCase视图。我也有Cygwin可用。

I'm looking for a command line to remove all view-private files and directories from a ClearCase view on Windows. I have Cygwin available as well.

脚本可在这篇文章不是我想要的,因为我正在处理大量的文件,并希望删除所有,而不必选择每一个。

The script available at this article is not quite what I want, since I'm working with a large number of files and want to delete them all without having to select each one.

几句话:


  • 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".