संपादित करें

इसके माध्यम से साझा किया गया


Folderdiff command (Team Foundation Version Control)

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Visual Studio 2019 | Visual Studio 2022

Use the TFVC folderdiff command to display and compare a visual representation of the differences between files in two server folders, in a server folder and a local folder, or in two local folders.

Prerequisites

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

Syntax

tf folderdiff [sourcePath] targetPath [/recursive] [/noprompt] [/collection:TeamProjectCollectionUrl] [/filter:filter] [/filterLocalPathsOnly] [/login:username,[password]] [/view:same,different,sourceOnly,targetOnly]

Parameters

Arguments

Argument

Description

<sourcePath>

The local or server source path in the compare operation. If this argument isn't supplied and targetPath is the local mapped path, sourcePath is the server path that it maps to.

<targetPath>

The local or server target path in the compare operation.

<filter>

A semicolon-delimited list of inclusion and exclusion filter masks for the /filter option. The default is *, or include all. See Remarks for a detailed description of filters and masks.

<TeamProjectCollectionUrl>

The URL of the project collection that contains the files for which you want to display and compare the differences, for example http://myserver:8080/tfs/DefaultCollection.

<username>

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

Options

Option

Description

/recursive

Optional. Fully compares the two folders recursively.

/noprompt

Optional. Runs tf folderdiff without displaying the output in the Visual Studio Folder Difference window. The command prompt window displays the output instead.

/filter

Optional. Specifies a list of inclusion and filter masks that are used to match the names of files and folders to be compared.

/filterLocalPathsOnly

Optional. Specifies that only the local paths will be filtered, unless the corresponding server path exists.

/view

Optional. Specifies which information to include in the output by using a comma-separated list of the following values:

  • same displays files with the same content in both source and target directories.

  • different displays files with different content in both source and target directories.

  • sourceOnly displays files that exist only in the source directory.

  • targetOnly displays files that exist only in the target directory.

The default is different,sourceOnly,targetOnly.

/collection

Specifies the project collection.

/login

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

Remarks

The command prompt window displays the output if you specify /noprompt. Otherwise, the Visual Studio Folder Difference window displays the output.

When the system compares the local mapped folder to the server folder it's mapped to, the output in the Folder Difference window includes a list of pending changes. Also, the output in the Folder Difference window tells you whether or not the local folder contains the latest copy.

The output displayed in the command prompt window lists all the files in the folders in the following five sections:

  • Items that exist only in the server folder.
  • Items that exist only in the local folder.
  • Items that have different contents.
  • Items that have identical contents. You must specify the same argument with the /view option.
  • Summary.

File and folder filters

A filter is an ordered list of name masks used to match the name of files and folders to be compared. Masks can contain the question mark ? wildcard character to match exactly one character, and the asterisk * wildcard character to match zero or more characters.

You delimit the masks in a filter by using semicolons ;. Folder masks must end in a backslash \. To specify an exclusion mask, prefix the mask with an exclamation mark !.

The filter applies to the file and folder names by using the following rules:

  • When a filter specifies both file and folder masks, the file and folder masks are separated into a file mask list and a folder mask list. File masks apply only to file names. Folder masks apply only to folder names.

  • To match a file or folder name, the command compares the name to each mask in the filter in the order it was specified. As soon as the name matches a mask, the name is considered to be a match.

  • If the file masks in the filter contain an inclusion mask, files that don't match any of the file masks are excluded.

  • If the file masks in the filter contain only exclusion masks, files that don't match any of the file masks are included.

  • If the folder masks in the filter contain an inclusion mask, folders that don't match any of the folder masks are excluded.

  • If the folder masks in the filter contain only exclusion masks, folders that don't match any of the folder masks are included.

The following table lists filter name mask examples.

Name mask Description
*.cs Matches all C# files.
My*.bmp Matches all bitmap files that begin with My.
!*.exe Excludes all executable files.
!objd\ Excludes all objd folders.

The following table lists filter examples.

Filter Description
*.cs;!objd\;!obj\;!bin\ Matches all C# files except the ones in objd, obj, or bin folders.
!*.resx;!*.ini;!resources\;!*junk*\ Excludes all .resx and .ini files, all files in the resources folder, and all files in any folder that has a name that includes the word junk.

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

Examples

The following example compares the files in the server folder and a local folder, organizes the files in the local folder recursively, and displays the output in the command prompt window.

tf folderdiff $/<serverFolder> F:\<localFolder> /recursive /noprompt

Next steps