views:

3848

answers:

4

I want to check out all files in all subdirectories of a specified folder.

(And it is painful to do this using the GUI, because there is no recursive checkout option).

+6  A: 
cleartool find somedir -exec "cleartool checkout -nc \"%CLEARCASE_PN%\""

Also an article "ClearCase: The ten best scripts" might be helpful

aku
+10  A: 

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 -nc .../*

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 -nc \"%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)

VonC
A: 

thanks for the trick. i tried co -nc .../* and it worked great. however, when i tried the second command, i found out that %CLEARCASE_PN% is empty, and i keep getting a whole bunch of these error messages: "cleartool: Error: Unable to access "": 0."

is there something else i need to setup before running these commands?

thanks

andy
+4  A: 

I know this is a very late answer, but it may help others.

If you are using Linux, replace %CLEARCASE_PN% with $CLEARCASE_PN

Peewhy
Good point (+1): `CLEARCASE_PN` (for PathName) or `CLEARCASE_XPN` are both environment variables set by clearcase scripts (`cleartool find` for instance). The Windows syntax (`%...%`) or Unix syntax (`$...`) is in effect for them.
VonC