递归查找当前目录下所有视图私有文件的命令

发布于 2024-12-07 20:37:32 字数 40 浏览 1 评论 0原文

递归查找当前目录中所有视图私有文件的clearcase命令是什么?

What is the clearcase Command to find all view private files in the current directory recursively?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

路弥 2024-12-14 20:37:32

常用命令基于 cleartool ls

  • ct lsprivate:但仅适用于动态视图,不适用于快照视图
  • ct ls -rec -view_only:至少,它在快照和动态视图中都有效

,但是两者都列出了您签出的文件。

如果您只需要私有文件,即跳过被劫持/Eclipsed/签出和符号链接,则需要将它们过滤掉。

在 Windows 中,这将是:

for /F "usebackq delims=" %i in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do @echo "%i"

在 Unix 中:

cleartool ls -rec | grep -v "Rule:" | grep -v "hijacked" | grep -v "eclipsed" | grep -v "-->" | xargs echo

The usual commands are based on cleartool ls:

  • ct lsprivate: but it is only for dynamic views, not snapshot views
  • ct ls -rec -view_only: at least, it works in both snapshot and dynamic views

However both list also your checked-out files.

If you want only the private files, ie skipping the hijacked/eclipsed/checked-out and symlinks, you need to filter those out.

In Windows, that would be:

for /F "usebackq delims=" %i in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do @echo "%i"

In Unix:

cleartool ls -rec | grep -v "Rule:" | grep -v "hijacked" | grep -v "eclipsed" | grep -v "-->" | xargs echo
逆光飞翔i 2024-12-14 20:37:32

如果它可以帮助其他人阅读这个问题,这里是 VonC 的 Windows 解决方案,进行了一些小的更改以作为 Windows 脚本运行:

@echo off
setlocal
for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do @echo "%%A"

@echo 替换为 rmdir /S /Qdel /F 执行实际删除,如此处所述。所以最终的脚本是:

@echo off
setlocal
for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do rmdir /S /Q "%%A"
for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do del /F "%%A"

如果您在要清理的视图元素下另存为 .bat 文件,则脚本也会通过删除自身来进行清理:-)

In case it helps anyone else reading this question here is VonC's windows solution with a couple of minor changes to run as a windows script:

@echo off
setlocal
for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do @echo "%%A"

Replace @echo with rmdir /S /Q and del /F to do the actual deletions as described here. So the final script is:

@echo off
setlocal
for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do rmdir /S /Q "%%A"
for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do del /F "%%A"

If you save as a .bat file under the element of the view you are cleaning from, the script will clean up by deleting itself as well :-)

还在原地等你 2024-12-14 20:37:32

我通过@MilesHampson 修改了该版本,因为这为我返回了太多结果,并且我想将其作为批处理文件运行。

我的新文件不会位于 debugobj 文件夹中,因此,我不需要查看这些文件夹的任何结果...我也只在 C# 上工作。这就是我需要看到的。

@echo off
setlocal

@echo Searching, please wait as this can take a while...

for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->" ^| find /V "obj" ^| find /V "debug"`) do  ( 
  if "%%~xA"==".cs" echo %%A
  )
)

@echo === === === === === Search Complete === === === === === === 

pause

使用上述内容创建一个bat文件,将其放入根项目文件夹中并运行它。它将显示那些不在源代码管理中的内容。

I amended the version by @MilesHampson since this returned too many results for me and, I want to run this as a batch file.

My new files won't be in the debug or obj folder and as such, I don't need to see any results for those folders... I'm also only working on C#. So that's all I need to see.

@echo off
setlocal

@echo Searching, please wait as this can take a while...

for /F "usebackq delims=" %%A in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->" ^| find /V "obj" ^| find /V "debug"`) do  ( 
  if "%%~xA"==".cs" echo %%A
  )
)

@echo === === === === === Search Complete === === === === === === 

pause

Create a bat file with the above, drop it into your root project folder and run it. It will display those not in source control.

万水千山粽是情ミ 2024-12-14 20:37:32

如果它可以帮助其他人阅读这个问题,这里是 VonC 的 Unix 解决方案,经过一些小的更改可以在 Windows 上的 Cygwin 下运行。

在 Cygwin 中:

cleartool ls -rec | grep -v "Rule:" | grep -v "hijacked" | grep -v "eclipsed" | grep -v -- "-->" 

Cygwin 行与 VonC 给出的 Unix 类似,但请注意最后一个 grep 上需要双破折号(并且不需要 xargs)。

In case it helps anyone else reading this question, here is VonC's Unix solution with a couple of minor changes to run under Cygwin on Windows.

In Cygwin:

cleartool ls -rec | grep -v "Rule:" | grep -v "hijacked" | grep -v "eclipsed" | grep -v -- "-->" 

The Cygwin line is similar to the Unix given by VonC, but note the double-dash on the last grep is needed (and the xargs is not needed).

向日葵 2024-12-14 20:37:32
ct lsprivate -other 

还会过滤出签出的文件

ct lsprivate -co :列出所有签出的文件

ct lsprivate -do :列出所有派生的对象文件

ct lsprivate -other :列出所有其他私有文件

ct lsprivate -other 

Would also filter out checked-out files

ct lsprivate -co : list all checked-out files

ct lsprivate -do : list all derived object files

ct lsprivate -other : list all other private files

不回头走下去 2024-12-14 20:37:32

我遵循了上述所有解决方案,这是一个很棒的命令。我还有一些上面未涵盖的要求,因此我用以下附加点对脚本进行了更多修改

  1. 从列表中排除了批处理文件(否则当前批处理文件也出现在列表中)
  2. 从列表中删除了目录,因为我通常对文件感兴趣< /p>

  3. 专门针对 java 开发人员,排除了目标文件夹和 jar 文件
    因为它们通常不会被签入

  4. Removed .classpath, .project 中检查
    和特定于 Eclipse 的 .settings 文件夹(如果它们相同)
    级别为项目/模块)

    <前><代码>@echo 关闭
    设置本地

    @回声。
    @echo 正在搜索,请稍候,因为这可能需要一段时间...
    @回声。
    for /F "usebackq delims=" %%i in (`cleartool ls -rec ^| find /V "规则:" ^| find /V "劫持" ^| find /V "黯然失色" ^| find /V "- ->" ^| find /V ".settings" ^| find /V "jar" ^| find /V "keep" ^| find /V "target" ^| find /V ".classpath" ^| 查找 /V ".project" ^| 查找 /V "%~n0" `) do ( 如果不存在 %%i\* @echo "%%i")

    @回声。
    @echo === === === === === 搜索完成 === === === === === ===
    @回声。
    @回声。

    暂停

I followed all above solutions and it is great command. I had some more requirements that were not covered above so I modified script little more with below additional points

  1. Excluded batch file from list (otherwise current batch file also coming in list)
  2. Removed Directory from list as generally I am interested in file

  3. Specially for java developer, excluded target folder and jar files
    as they are not generally checked in

  4. Removed .classpath, .project
    and .settings folder which is specific to Eclipse (if they are same
    level as project/modules)

    @echo off
    setlocal
    
    @echo.
    @echo Searching, please wait as this can take a while...
    @echo.
    for /F "usebackq delims=" %%i in (`cleartool ls  -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->" ^| find /V ".settings" ^| find /V "jar" ^| find /V "keep" ^| find /V "target" ^| find /V ".classpath"  ^| find /V ".project" ^| find /V "%~n0" `) do ( if not exist %%i\* @echo "%%i")
    
    @echo.
    @echo === === === === === Search Complete === === === === === === 
    @echo.
    @echo.
    
    pause
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文