--- title: "New-VBRSelectedFilesLegacyPathMask" description: "This cmdlet creates the VBRSelectedFilesLegacyPathMask object. This object defines a path mask in the format of the exclude masks of Veeam Backup & Replication 13.1 and earlier." canonical: "https://helpcenter.veeam.com/docs/vbr/powershell/new-vbrselectedfileslegacypathmask.html" breadcrumb: "Veeam PowerShell Reference > Veeam PowerShell Reference > Veeam Agent Management > Working with Veeam Agent Backup Jobs and Policies > Veeam Agent Job Backup Scope > New-VBRSelectedFilesLegacyPathMask" dateModified: "2026-11-17" --- # New-VBRSelectedFilesLegacyPathMask ## Short Description Defines a legacy path mask to exclude folders from the backup scope of Veeam Agent backup jobs. **Product Edition**: Community, Standard, Enterprise, Enterprise Plus, Veeam Universal License ## Syntax ``` New-VBRSelectedFilesLegacyPathMask -Path [] ``` ## Detailed Description This cmdlet creates the [`VBRSelectedFilesLegacyPathMask`](vbrselectedfileslegacypathmask.md) object. This object defines a path mask in the format of the exclude masks of Veeam Backup & Replication 13.1 and earlier. You can use the mask only to exclude folders from the backup scope of a Veeam Agent backup job. Veeam Backup & Replication creates masks of this type from the exclude masks of earlier versions that contain a path separator of the protected OS, for example `/var/log*` or `C:\Temp\*`. Exclude masks that contain only a file name or extension, for example `*.tmp`, become wildcard masks. The same conversion applies to the values of the obsolete `ExcludeMask` parameter. Note that legacy path masks and path masks are evaluated differently. A legacy path mask excludes a folder as a whole, but a folder that is specified in the `SelectedFiles` parameter inside it is still backed up. Objects excluded by a path mask cannot be included again by any other setting. For new exclusions, use the [`New-VBRSelectedFilesPathMask`](new-vbrselectedfilespathmask.md) cmdlet. To apply the mask, set it as the `ExclusionMask` parameter value of the [`New-VBRSelectedFilesBackupOptions`](new-vbrselectedfilesbackupoptions.md) or [`Set-VBRSelectedFilesBackupOptions`](set-vbrselectedfilesbackupoptions.md) cmdlet. **Note**: You cannot use legacy path masks as the `InclusionMask` parameter value. ## Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

Path

Specifies the full path to the folders that you want to exclude from the backup scope. The mask matches only folders: files whose names match the mask are backed up. You can use wildcard characters only in the last element of the path, for example C:\Reports\Old*. You cannot use the ** recursive pattern.

For Windows computers, you can start the path with a system environment variable preceded by the backslash sign, for example \%TEMP%\logs.

String

True

Named

True (ByPropertyName, ByValue)

`` This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see [ Microsoft Docs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7). ## Output Object The cmdlet returns the `VBRSelectedFilesLegacyPathMask` object that defines a legacy path mask for excluding folders from the backup scope. ## Examples ::: example ### Example 1. Excluding Folder from Backup Scope Using Legacy Path Mask (Windows) This example shows how to exclude the *C:\Temp* folder from the backup scope of a Veeam Agent backup job. ``` $mask = New-VBRSelectedFilesLegacyPathMask -Path "C:\Temp" New-VBRSelectedFilesBackupOptions -OSPlatform Windows -BackupSelectedFiles -SelectedFiles "C:\" -ExclusionMask $mask ``` Perform the following steps: 1. Run the `New-VBRSelectedFilesLegacyPathMask` cmdlet. Specify the `Path` parameter value. Save the result to the `$mask` variable. 2. Run the [`New-VBRSelectedFilesBackupOptions`](new-vbrselectedfilesbackupoptions.md) cmdlet. Specify the following settings: - Set the `Windows` value for the `OSPlatform` parameter. - Provide the `BackupSelectedFiles` parameter. - Specify the `SelectedFiles` parameter value. - Set the `$mask` variable as the `ExclusionMask` parameter value. ::: ::: example ### Example 2. Excluding Directory from Backup Scope Using Legacy Path Mask (Linux) This example shows how to exclude the */home/user01/.cache* directory from the backup scope of a Veeam Agent backup job that backs up a Linux computer. ``` $mask = New-VBRSelectedFilesLegacyPathMask -Path "/home/user01/.cache" New-VBRSelectedFilesBackupOptions -OSPlatform Linux -BackupSelectedFiles -SelectedFiles "/home/user01" -ExclusionMask $mask ``` Perform the following steps: 1. Run the `New-VBRSelectedFilesLegacyPathMask` cmdlet. Specify the `Path` parameter value. Save the result to the `$mask` variable. 2. Run the [`New-VBRSelectedFilesBackupOptions`](new-vbrselectedfilesbackupoptions.md) cmdlet. Specify the following settings: - Set the `Linux` value for the `OSPlatform` parameter. - Provide the `BackupSelectedFiles` parameter. - Specify the `SelectedFiles` parameter value. - Set the `$mask` variable as the `ExclusionMask` parameter value. ::: ## Related Commands - [`New-VBRSelectedFilesBackupOptions`](new-vbrselectedfilesbackupoptions.md) - [`New-VBRSelectedFilesPathMask`](new-vbrselectedfilespathmask.md) - [`Set-VBRSelectedFilesBackupOptions`](set-vbrselectedfilesbackupoptions.md)