Web Deploy filePath Provider
Applies To: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP
The filePath provider synchronizes individual files.
msdeploy -verb:sync -source:filePath=c:\OriginSite\default.html -dest:filePath=c:\NewSite\default.html
The filePath provider returns the file path of the file specified in the -source argument, or synchronizes the source file to the destination file specified in the -dest argument. The filePath provider takes the full path of a single file (for example, c:\msdeploy\destinationfolder\file2.txt). UNC paths and mapped network drives are supported. Environment variables like %windir% are supported, but wildcard characters are not. If the path contains spaces, the path must be enclosed in double quotation marks.
In a dump operation, only the file path of the specified file is returned. If you also specify the -xml operation setting, the results are returned in XML format and include file attribute information. To view ACL information in the attribute output, use the includeAcls provider setting, as in the following example.
msdeploy -verb:dump -source:filepath="c:\Windows\notepad.exe",includeAcls=true -xml
In a sync operation, if the file does not exist in the destination folder, the file is created. If the file already exists in the destination folder, the file is updated to match the file of the source. This includes attribute information. For example, if the destination file is read-only but the source file is read/write, the destination file will become read/write. The source and destination values for filePath do not have to be the same. If the name of the destination file differs from that of the source, the name of the destination file will remain the same, but the contents of the file will be updated to those of the source.
You cannot use the archiveDir for the destination when filePath is the source.
Because the FAT file system cannot preserve NTFS file system ACLs, you should not synchronize files from an NTFS file system to a FAT file system. If you do so, no warning will be issued. Note that, in any case, Windows Server® 2008 (and IIS 7) cannot be installed on FAT32 file systems. For security reasons, the use of IIS 6.0 on FAT file systems is not recommended.
The filePath provider does not automatically synchronize ACLs. If you want to copy these permissions, you can set the includeAcls provider setting to true so that ACLs will be included in the synchronization. The permissions are copied as security identifiers (SIDs). If you are using local accounts, the destination computer must have the same accounts that use the same SIDs for the permissions to be set correctly.
By default, includeAcls is false. Files that are created on the destination will inherit their ACLs from the destination.
The filePath provider has a custom provider setting, ignoreErrors, that is also used by the dirPath provider.
The ignoreErrors feature is not available in the Release Candidate (RC) version of the Web Deployment Tool.
ignoreErrors specifies a semicolon-delimited list of file system error codes that will be ignored during an operation. For the errors specified, a warning will be issued, but the operation will continue. If ignoreErrors is not specified, no file system errors will be ignored.
The ignoreErrors provider setting is useful because it lets you ignore errors on files that you can safely ignore or copy later. It lets you avoid the frustration of having a synchronization operation fail because of errors that you consider to be relatively minor.
Usage 1: filePath=<path>,ignoreErrors=<ErrorNumber>[;<ErrorNumber>;…]
msdeploy -verb:sync -source:filepath=c:\Site1\Site1.htm -dest:filepath=c:\Site2\Site2.htm,ignoreErrors=8000020;80070005
<ErrorNumber> is a file system error number. For example, 0x80070020 is the File In Use error, and 0x80070005 is the Access Denied error. The "0x" prefix is optional (that is, either 80070020 or 0x80070020 is valid.) <ErrorNumber> cannot be a range of values. If no error number is specified, no file system errors will be ignored.
If a sync operation attempts to delete a folder in which a file is being used and you have specified
,ignoreErrors=80070020 (File In Use error) in the command, the file will be skipped, but the directory deletion will fail because the directory is not empty and therefore cannot be deleted.
Beware of possible file corruption on the destination computer when you use the ignoreErrors provider setting under the following conditions.
- A file on the source is different from the file on the destination.
- The file on the source is being used (and is therefore locked.)
- In the command for the sync operation, you specified
,ignoreErrors=80070020for the dirPath or filePath providers.
Using ignoreErrors with the contentPath provider
The contentPath provider uses both the filePath and dirPath providers. When you use the contentPath provider, you can take advantage of this relationship by using the following syntax.
Usage 2: contentPath=<path>,filePath.ignoreErrors=<ErrorNumber>[;<ErrorNumber>;…]
Notice that in this usage, ignoreErrors is preceded by a period.
msdeploy -verb:sync -source:contentPath=c:\Site1 -dest:contentPath=c:\Site2,filepath.ignoreErrors=8000020;80070005
The example specifies that the contentPath provider will copy the content of Site1 to Site2. During the copy operation, if any files in the destination produce File In Use or Access Denied errors, the errors will be ignored, and the operation will continue.
Related Web Deploy Rules
The following rules are related to the filePath provider.
Allows files to remain on the destination that are not on the source. This rule is disabled by default.
Ignores the last write times of files and compares them based on checksums when the
Skips updates to files that have a more recent write time. This rule is disabled by default.
These rules can be enabled or disabled by using the
-disableRule operation settings. For more information about these rules and operation settings, see Web Deploy Rules.
These rules and the
-useCheckSum operation setting are not available in the Release Candidate (RC) version of the Web Deployment Tool.
1) Return the file path of the specified file.
msdeploy -verb:dump -source:filepath=c:\webdeploy\sourcefolder\file1.txt
2) Return file path and attribute information in XML format.
msdeploy -verb:dump -source:filepath="c:\web deploy\source folder\file 1.txt" -xml
3) Update a destination file by using the file from the source.
msdeploy -verb:sync -source:filepath=c:\webdeploy\sourcefolder\file2.txt -dest:filepath=c:\webdeploy\destinationFolder\file2.txt