2
votes

After searching on this forum, I finally got down to these 2 command-lines below that I run in a batch file to delete ClearCase view-private directories and files in my snapshot view.

REM First delete view-private directories
for /F "usebackq delims=" %%i in (`cleartool ls -r ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do ( if exist "%%~i\" ( rmdir /S /Q "%%i" ) )

REM And then delete view-private files
for /F "usebackq delims=" %%i in (`cleartool ls -r ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do ( if not exist "%%~i\" ( del /S /Q /F /A:H "%%i" ) )

However, I get these errors from time to time:

Could Not Find C:\Source\Folder\FileA.log
Could Not Find C:\Source\Folder\FileB.log
Could Not Find C:\Source\Folder\SubFolder\FileC.pbl

The files are view-private files and they do exist at the provided location. But it looks like the batch file cannot "see" to delete them. What am I doing wrong?

3
If the path longer than 255 characters? - VonC
@VonC No, the longest path is only 144 characters. - TDN
All I can think of is right issue (no read access), or a process which keeps an handle on that file (try the same commands after a full Windows reboot) - VonC
You might be able to detect the issue by using the MS/System Internals Process Monitor tool. Running a procmon trace with the filter set to "Path... begins with ... c:\Source" and starting your script may give ytou some visibility into the issue. If you're actually using a dynamic view, and are on an old ClearCase release, you will want to patch up as procmon can BSOD certain older 7.1.x, 8.0.0, and (IIRC) 8.0.1.0 and 8.0.1.1 versions. - Brian Cowan

3 Answers

1
votes

I updated the delete command to remove the switches and my batch file was finally able to find the view-private files and delete them.

REM And then delete view-private files
for /F "usebackq delims=" %%i in (`cleartool ls -r ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do ( if not exist "%%~i\" ( del "%%i" ) )
0
votes

Why aren't you using cleartool ls -view_only? It eliminates a lot of the parsing fun here.

0
votes

Doesn't 'cleartool lsprivate -other' list what you want?