Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command line to delete all ClearCase view-private files

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.

like image 636
mbyrne215 Avatar asked Dec 15 '08 21:12

mbyrne215


People also ask

How do I see private files in ClearCase?

Answer. To find view-private files within a snapshot view, use cleartool ls -recurse -view_only .

What is VOB and view in ClearCase?

A VOB (versioned object base) is a permanent data repository that stores information that you have placed under Rational ClearCase® source control. A VOB stores the history of all the changes to your files. A view is a workspace where you make changes to your files.


2 Answers

A few remarks:

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

  • 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 /F "usebackq delims=" %i in (`cleartool ls -r ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do @echo "%i"

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.

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

like image 56
VonC Avatar answered Sep 21 '22 13:09

VonC


Under windows DOS prompt:

for /f "delims=" %f in ('cleartool lspriv -s -do -oth ^| sort /r') do @del /f /q "%f"
like image 31
Rajinikanth Avatar answered Sep 24 '22 13:09

Rajinikanth