file

Displays the element type that ClearCase® would use for a file

Applicability

Product

Command type

ClearCase

cleartool subcommand

Platform

UNIX

Linux

Windows

Synopsis

file [ –invob pname ] [ –all ] pname...

Description

The file command is similar to the UNIX and Linux file(1) command, which determines the file type of a specified file. cleartool file displays the element type ClearCase would use for the specified file if the file were converted to an element.

file uses the following process to find the element type:

  1. Search magic files for the first rule that matches the file's type.

    For more information on magic files, file-typing, and the search path for magic files, see the cc.magic reference page.

  2. Compare the element types in the rule with the element types in a particular VOB.

    By default, file uses the VOB containing the view-private file. If the file is not in a VOB, the command uses the VOB containing the current working directory.

  3. Display the first element type in the rule that exists in the VOB.

    file processes the element types in the rule from left to right. (In a magic file rule, element types are listed from most to least specific.) For example, with a rule like the following:

    txt document text_file : -printable & -name "*.[tT][xX][tT]" ;

    file first looks for an element type named txt and displays it if it exists in the VOB. If txt does not exist in the VOB, file looks for an element type named document and displays it if it exists. If document does not exist, file displays the text_file element type.

The above rules apply even if the specified file does not exist. This is good for testing magic file customizations for certain kinds of names.

For information about creating new element types in a VOB, see the mkeltype reference page.

Restrictions

None.

Options and arguments

–invob vob-pname
Compares the potential element types against the list of element types in the specified VOB.
–all
Skips the comparison with the list of element types in the VOB and prints every element type in the magic file rule.

Examples

  • Display the element type that would be used for a view-private HTML file.

    cleartool file foo.html
    foo.html: html

  • List all possible element types for a view-private HTML file.

    cleartool file –all foo.html
    foo.html: html_source html web_file source text_file

  • On a UNIX or Linux system, display the element type that would be used if the file were converted to an element in the VOB /vobs_dev.

    cleartool file –invob /vobs_dev foo.html
    foo.html: html_source

  • On a Windows system, display the element type that would be used if the file were converted to an element in the VOB \dev.

    cleartool file –invob \dev foo.html
    foo.html: html_source

UNIX and Linux files

ccase-home-dir/config/magic/default.magic

Windows files

ccase-home-dir\config\magic\default.magic