Udostępnij za pośrednictwem


Folderdiff Command

Use the 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.

Required Permissions

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

tf folderdiff [sourcePath] targetPath [/recursive] [/noprompt] [/server:serverName:port] [/filter:filter] [/filterLocalPathsOnly] [/view:same,different,sourceOnly,targetOnly]

Parameters

Argument

Description

sourcePath

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

targetPath

The local or server path that is the target path in the compare operation.

serverName:port

If specified, all server paths are assumed to be located on this server. This parameter takes precedence over local path mapping.

filter

Specifies a semicolon delimited list of inclusion and exclusion filter masks for the /filter option. Default is "*" (include all). The Remarks section in this topic includes a detailed description of filters and masks.

Option

Description

/recursive

Optional. Specifies that the two folders are fully compared recursively.

/noprompt

Optional. tf folderdiff runs without displaying user interface. The output is displayed in the Command Prompt window 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 what information is included in the output using a comma separated list of the following values:

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

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

sourceOnly—output displays files that exist only in source directory.

targetOnly—output displays files that exist only in target directory.

The default is "different,sourceOnly,targetOnly"

Remarks

The Command Prompt window displays the output if you specify /noprompt. Otherwise, the Folder Difference window displays the output. When the system compares the local mapped folder to the server folder to which it is mapped, the output in the Folder Difference window includes a list of pending changes. Also, the output in the Folder Difference window tells you whether the local folder contains the latest copy or not.

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. Each mask can contain the wildcard characters question mark (?) and asterisk (*). '?' matches exactly one character and '*' matches zero or more characters. The masks in a filter are delimited by semicolons (;). Folder masks must end in backslash (\). To specify an exclusion mask, prefix the mask with an exclamation mark (!).

The filter is applied to the file and folder names using the following rules:

  • When both file and folder masks are specified together in a filter, the file masks are separated into a file mask list and the folder masks are separated into the folder mask list. File masks are applied only to file names. Folder masks are applied only to folder names.

  • When the command matches a file or folder name, it 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 do not match any of the file masks are excluded.

  • If the file masks in the filter contain only exclusion masks, files that do not match any of the file masks are included.

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

  • If the folder masks in the filter contain only exclusion masks, folders that do not match any of the folder masks are included.

These are some examples of filter masks:

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

These are some examples of filters:

Mask

Description

*.cs;!objd\;!obj\;!bin\

Matches all C# files, and excludes objd, obj, and bin directories

!*.resx;!*.ini;!resources\;!*junk*\

Excludes all resx and ini files as well as the folders "resources" or folders that have "junk" in the name

For more information on how to find the tf command-line utility, see Tf Command-Line Utility Commands.

Examples

The following example compares the files in the server folder and a local folder. It organizes the files in the localFolder recursively and displays the output in the Command Prompt window.

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

See Also

Tasks

How to: Compare Two Folders

How to: View File Changes Using Annotate

How to: Reconcile Differences Between Two Folders

Concepts

Folder Comparison Filters

Other Resources

Comparing Folders and Files in Version Control

Tf Command-Line Utility Commands

Working with Version Control Files and Folders