--- title: "New-VBRSelectedFilesPathMask" description: "This cmdlet creates the VBRSelectedFilesPathMask object. This object defines a path mask that you can use to include files and folders in the backup scope of a Veeam Agent backup job or to exclude them from it." canonical: "https://helpcenter.veeam.com/docs/vbr/powershell/new-vbrselectedfilespathmask.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-VBRSelectedFilesPathMask" dateModified: "2026-11-17" --- # New-VBRSelectedFilesPathMask ## Short Description Defines a path mask for the backup scope of Veeam Agent backup jobs. **Product Edition**: Community, Standard, Enterprise, Enterprise Plus, Veeam Universal License ## Syntax ``` New-VBRSelectedFilesPathMask -Path [] ``` ## Detailed Description This cmdlet creates the [`VBRSelectedFilesPathMask`](vbrselectedfilespathmask.md) object. This object defines a path mask that you can use to include files and folders in the backup scope of a Veeam Agent backup job or to exclude them from it. The mask accepts full paths, the `*` and `?` wildcard characters and the `**` recursive pattern. You can use path masks for Veeam Agent backup jobs that back up Windows, Linux, macOS and Unix computers. The path format depends on the OS, see the `Path` parameter. To apply the mask, set it as the `InclusionMask` or `ExclusionMask` parameter value of the [`New-VBRSelectedFilesBackupOptions`](new-vbrselectedfilesbackupoptions.md) or [`Set-VBRSelectedFilesBackupOptions`](set-vbrselectedfilesbackupoptions.md) cmdlet. **Note**: If the backup scope of a job that backs up a Windows computer includes an entire volume, Veeam Agent for Microsoft Windows backs up this volume at the volume level and does not apply path masks to it. The job session shows an informational message that these path patterns were skipped. ## Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

Path

Specifies the full path to the files or folders that you want to include in the backup scope or exclude from it. The path format depends on the OS of the protected computer:

  • For Windows computers, start the path with a drive letter, for example C:\Users, or with a system environment variable preceded by the backslash sign, for example \%ProgramData%\Logs. You can use only system environment variables defined for the Local System account.
  • For Linux, macOS and Unix computers, start the path with the slash sign, for example /home.

You can use the * and ? wildcard characters. You can also use the ** recursive pattern to match any number of nested folders. The ** pattern must take a whole path segment, for example C:\**\Temp.

At the end of a mask, ** matches the contents of the folder, not the folder itself: C:\Temp\** matches everything inside C:\Temp but not the C:\Temp folder.

In the middle of a mask, ** also matches zero folders: /data/**/report.log matches /data/report.log.

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 `VBRSelectedFilesPathMask` object that defines a path mask for the backup scope. ## Examples ::: example ### Example 1. Excluding Folders from Backup Scope Using Path Mask (Windows) This example shows how to exclude the *Downloads* folders of all user profiles from the backup scope of a Veeam Agent backup job that backs up a Windows computer. ``` $mask = New-VBRSelectedFilesPathMask -Path "C:\Users\*\Downloads" New-VBRSelectedFilesBackupOptions -OSPlatform Windows -BackupSelectedFiles -SelectedFiles "C:\Users" -ExclusionMask $mask ``` Perform the following steps: 1. Run the `New-VBRSelectedFilesPathMask` 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. Including Files in Backup Scope Using Recursive Path Mask (Linux) This example shows how to back up only the LOG files from the `/var/log` directory and all its nested directories on a Linux computer. ``` $mask = New-VBRSelectedFilesPathMask -Path "/var/log/**/*.log" New-VBRSelectedFilesBackupOptions -OSPlatform Linux -BackupSelectedFiles -SelectedFiles "/var/log" -InclusionMask $mask ``` Perform the following steps: 1. Run the `New-VBRSelectedFilesPathMask` 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 `InclusionMask` parameter value. ::: ## Related Commands - [`New-VBRSelectedFilesBackupOptions`](new-vbrselectedfilesbackupoptions.md) - [`Set-VBRSelectedFilesBackupOptions`](set-vbrselectedfilesbackupoptions.md)