Dir Command

The dir command displays the contents of the Team Foundation source control server, or a part of the Team Foundation source control server.

tf dir [/server:servername] itemspec [/version:versionspec] 
[/recursive] [/folders] [/deleted] 

Parameters

Argument Description

servername

The user-provided value for the /server option. Example: teamfoundation2.

itemspec

Required. Identifies the file or folder to return information about. For more information about how Team Foundation parses itemspecs to determine which items are within scope, see Command-Line Options.

versionspec

The user-provided value for the /version option. For more information about how Team Foundation parses a version specification to determine which items are within its scope, see Command-Line Syntax.

Option Description

/server

Identifies the Team Foundation Server. This option is required if the command is invoked from a directory that is not mapped to a workspace.

/version

Specifies that Team Foundation should only show files and folders of a certain version.

/recursive

Displays all files and subfolders in the specified directory.

/folders

Displays folders only.

/deleted

Displays deleted items and existing items. The deleted items are followed with ;X3 where 3 is the deletion id.

Remarks

The dir command operates on the Team Foundation source control server copies of files, not the local copies. The local folder is used to locate the appropriate Team Foundation source control server path of display. You use this command to explore the Team Foundation source control server and identify files you may have to obtain.

For links to other Team Foundation commands that provide additional information about items in your Team Foundation source control server and the workspaces that map to it, see Informational Commands.

Examples

The following example displays a list of files, folders, subfolders, and the files therein in the Team Foundation source control server folder to which c:\projects maps. For more information about how to view and edit working folder mappings, see Workspace Command and Workfold Command.

c:\projects>tf dir /recursive
  • Sample output:

    $/:
    $314
    x.c
    y.c
    z.c
    $/314:
    $1254
    $314/1254:
    $folder1
    x.c
    y.c
    8 item(s)
    

The following example uses the current workspace to map the "314dir" subfolder of the local working folder into a Team Foundation source control server path. It displays all Team Foundation source control server files at that path. The "314dir" subfolder does not have to exist in the local folder.

c:\projects>tf dir 314dir

The following example uses the current workspace to map the "314dir" subfolder of the local working folder into a esprscc path and displays the version of files labeled “My label” in that Team Foundation source control server path. The "314dir" subfolder does not have to exist in the local folder.

c:\projects>tf dir /version:L"My label" 314dir

The following example displays all folders in the root of the Team Foundation source control server. The local working folder is ignored because $/ denotes a Team Foundation source control server path.

c:\projects>tf dir /folders $/

The following example lists every file and folder in the Team Foundation source control server.

c:\projects>tf dir /recursive $/

The following example lists all items and deleted items in the current folder together with their deletion IDs.

c:\projects>tf dir /deleted

Security

To use the dir command, you must have Read permission set to Allow. For more information, see Team Foundation Server Permissions.

See Also

Tasks

How to: Add and Remove a Working Folder in a Workspace

Reference

Workspace Command
Workfold Command

Concepts

Informational Commands

Other Resources

Tf Command-Line Utility Commands