I am trying to checkout file using Cleartool co command . If a file is symlink it fails as
cleartool: Error: Not an element:
Due to this my checkout action fails . I want to avoid that. I want to check whether the file is symlink before checkout. Is there a cleartool command available to find whether a file is symlink?
The article "Symbolic links in snapshot views" provide some context to the error message:
You cannot check out a file element from a symbolic link path; you must check out the link target.
You will find more in "About checking out Symbolic Link (symlink) Targets in dynamic views"
In a snapshot view, the symbolic link target must be loaded in your view also, in order for the Symlink Target Operations to appear.
However, these options are limited, such as the checkout does not work, and the alternatives are to either Warp To Symlink Target or use a dynamic view.
So:
I want to check whether the file is symlink before checkout.
Considering cleartool ln
, cleartool describe
and fmt_ccase
, I would do before a checkout:
cleartool describe -fmt "%[slink_text]p" myFile
That will display the arget of symbolic link, as displayed by cleartool ls
.
If the result is empty, it is not a symlink.