Condividi tramite


Dir Command

TFS 2017 | TFS 2015 | TFS 2013

Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | Visual Studio 2013

The dir command displays all or some of the contents of the server for Team Foundation version control.

Prerequisites

To use the dir command, you must have Read permission set to Allow. For more information, see Default TFVC permissions.

Syntax

tf dir itemspec [/version:versionspec] [/recursive] 
[/folders] [/deleted] [/login:username,[password]] [/collection:TeamProjectCollectionUrl]

Parameters

Argument

Argument

Description

itemspec

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 Use Team Foundation version control commands, Use options to modify how a command functions.

Note

You can specify more than one Itemspec argument.

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 Use Team Foundation version control commands.

username

Provides a value to the /login option. You can specify a username value as either DOMAIN\UserName or UserName.

TeamProjectCollectionUrl

The URL of the project collection that contains one or more files or folders about which you want to display information (for example, http://myserver:8080/tfs/DefaultCollection/).

Option

Option

Description

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

/login

Specifies the user name and password to authenticate the user with Azure DevOps.

/collection

Specifies the project collection.

Remarks

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

For more information on how to find the tf command-line utility, see Use Team Foundation version control commands.

Examples

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

c:\projects>tf dir /recursive

The following example displays all Team Foundation version 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 displays the version of files labeled "My label" in that Team Foundation version 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 version control server. The local working folder is ignored because $/ denotes a Team Foundation version control server path.

c:\projects>tf dir /folders $/

The following example lists every file and folder in the Team Foundation version 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