How do I perform a recursive checkout using ClearCase?

Beware: ClearCase is File-centric, not repository centric (like SVN or CVS).

That means it is rarely a good solution to checkout all files (and it can be fairly long with ClearCase 😉 )

That being said, the question is perfectly legitimate and I would like to point out another way:

open a cleartool session in the ‘specified folder’:

c:\MyFolder> cleartool
cleartool> co -c "Reason for massive checkout" .../*

does the trick too. But as the aku’s answer, it does checkout everything: files and directories… and you may most not need to checkout directories!

cleartool find somedir -type f -exec "cleartool checkout -c \"Reason for massive checkout\" \"%CLEARCASE_PN%\""

would only checkout files…

Now the problem is to checkin everything that has changed. It is problematic since often not everything has changed, and CleaCase will trigger an error message when trying to check in an identical file. Meaning you will need 2 commands:

ct lsco -r -cvi -fmt "ci -nc \"%n\"\n" | ct
ct lsco -r -cvi -fmt "unco -rm %n\n" | ct

(with ‘ct being ‘cleartool‘ : type ‘doskey ct=cleartool $*‘ on Windows to set that alias)

Note that ct ci -nc will check-in with the comment used for the checkout stage.
So it is not a checkin without a comment (like the -nc option — or “no comment” — could make believe).

Leave a Comment