I have a ClearCase view with a folder, and two files. I check out the folder, remove a file and check the folder back in. I am left with one folder and one file. Is there a way to get my file back? I'm using the standard Windows suite of tools, which include cleartool.
Yes, it is possible to get the file back. This is an important feature of ClearCase (and a life-saver on occasion).
Let's say that your directory is /vobs/somevob/somedir
. The version of the directory with two files in it was /main/3
; the version with one file was therefore /main/4
. The dropped file is /vobs/somevob/somedir/crucial
. Assuming ct
is an alias for cleartool
, you then do:
cd /vobs/somevob/somedir
ct co -c 'Recover file crucial' .
ct ln .@@/main/3/crucial .
ct ci -nc .
The first line means I don't have to type the path to the directory in the other three commands; otherwise, it is optional. The second line checks out the directory so it can be edited. The last line checks in the modified directory. The third line is where the magic occurs...
The ct ln .@@/main/3/crucial .
line identifies the file crucial
that was seen in version /main/3
of the directory .
and links it to the current directory (the checked out version of the directory). The file version you see will be the one chosen by your cspec, but the correct file is in the view (assuming you do in fact pick up /vobs/somevob/somedir@@/main/5
with your cspec).
(Note that you aren't limited to doing the link one version back; you can reinstate a file after 10 years and 20 versions if you need to. Although you can link a file to two directories at once, that is highly unrecommended; use a symlink instead. You could recover a deleted file into a different directory from its last known location.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With