Command to find all view private files in the current directory recursively

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


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

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


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.