Filter Settings

<< Click to Display Table of Contents >>

Navigation:  Using SyncBackPro > Technical Reference >

Filter Settings

 

Define what file types and directories are copied and which are not. Note that if you filter out the desktop.ini file, and have the option to use the desktop.ini file set, then it will be highlighted in yellow in the filter settings window. This same window is also used to specify verification and versioning filters.

 

file-folder-filters

 

 

burger Burger Menu

 

oTest Filters (Ctrl+T): If selected a window appears where you can enter a file name or a folder name. A folder name must have a trailing slash, e.g. \folder\, otherwise it is assumed to be a file name. You should enter a relative name and not an absolute name, although absolute names can be used. For example, C:\folder\filename.txt is an absolute name but \folder\filename.txt is a relative name. The reason for this is that an absolute name will only refer to the source/left or destination/right and not both. Note that if you're using variables either in the source/left or destination/right, or in the filters, then the test may not be accurate because variables are variable by definition (meaning their value changes).

 

oCopy these settings from another profile: By selecting this menu item you can copy the filter settings from another profile.

 

oRevert to defaults: If selected then the filters will be reset to the defaults as set by you (see Make these the defaults in Settings above).

 

oRevert to factory settings: If selected then the filters will be reset to the default factory settings.

 

oRe-apply Filter: If clicked, then the filter will be re-applied to the selections you have made in the tree. For example, if you have selected to exclude all files with the extension .tmp then if you have selected a file in the tree which does have that extension then you will be prompted if you'd like to unselect that file. Use the "Re-apply Filter" button instead of the OK button when you haven't made any changes to the filters but want to re-apply them.

 

Settings

 

oDo not use filters (can improve performance): If this is selected then no filtering is performed. This can reduce the run time of a profile, sometimes substantially. To further improve performance you may also want to disable file & folder selections. You can also switch off filters using the -nofilter command line parameter.

 

oUse Windows file exclusion filters: If this option is enabled then the standard Windows backup file filters are also used. These are files that Windows itself recommends are not included in any backups. For example, any files in the temporary folder. Note that this option is not available if the profile is using Fast Backup (without the archive attribute).

 

oMake these the defaults: If selected then the filters you have set for this profile will become the default filters for all newly created profiles. See the pop-up menu below for copying the filter settings from another profile or reverting them to default values.

 

Filter: SyncBackPro supports three different types of filters: Old V3 style filters, Regular expressions and DOS expressions. See the help below for details on how to use these. Note that you should not use semi-colons (;) if you are using DOS expressions. This is due to a limitation in the Windows operating system call that is used to compare filenames using filters.

 

At the bottom of the window are a number of buttons:

 

Add (Files/folders to copy): If clicked a dialog box appears letting you enter a filter expression for files and folders to include. You can enter a filename, a folder name, a complete path, etc. Anything matching this expression will be copied. You can enter multiple filters at the same time by using the forward slash (/) to separate them, e.g. item1/item2/item3. You can also press the Again button to immediately enter another filter item.

 

Remove (Files/folders to copy): If clicked then the selected items will be removed from the list.

 

Add (Files/folders NOT to copy): If clicked a dialog box appears letting you enter a filter expression for files and folders to exclude. You can enter a filename, a folder name, a complete path, etc. Anything matching this expression will be not be copied. You can enter multiple filters at the same time by using the forward slash (/) to separate them, e.g. item1/item2/item3. You can also press the Again button to immediately enter another filter item.

 

warning

To edit an existing filter you can double-click on the filter entry or press F2.

 

file-mask

 

Remove (Files/folders NOT to copy): If clicked then the selected items will be removed from the list. You can also double-click on an item in the list to change it.

 

 

When you make a change to the filters, and click OK to save them, then the new filters will be re-applied to the selections you made in the tree.

 

warning

Note: to modify an existing filter double-click it or select it and press F2. You can also click on a filter item (in Files/folders to copy or Files/folders NOT to copy) and press Ctrl-C to copy all the filter items to the Windows clipboard. Pressing Ctrl-A will select all filter items.

 

Select Settings->Copy these settings from another profile to copy all the filters from another profile.

 

You can use SyncBackPro and Windows Environment variables in the filters, e.g. %HOMEPATH%

 

 

What are the filters compared with?

 

A filter is compared with the folders and filenames (which include the path). The root source and destination directories are not used, i.e. they are relative paths.

 

For example, if your source directory is C:\My Files\ and it includes a folder called SubFolder and a file called file.txt then the filters would be compared against the following:

 

\

\SubFolder\

\file.txt

 

An important point to remember is that folders include a trailing backslash, but files do not.

 

If you are using DOS Expressions (not regular expressions) then you can use full paths in filters, i.e. you can use absolute paths. In SyncBackPro V10, you could use absolute paths, but they had to exactly match the beginning of the source or destination path. For example:

 

Filter:                C:\My Files\Sub-Directory\*

Source:                C:\My Files\

Destination:        D:\My Backup\

 

The above would work because the start of the filter matches the source directory (C:\My Files\). However, in SyncBackPro V10 the following would not work:

 

Filter:                C:\*cache*\

Source:                C:\My Files\

Destination:        D:\My Backup\

 

This is because the filter does not match the source or destination so it would be ignored.

 

Starting with SyncBackPro V11, a filter can be an absolute path and it will be used if the filters drive (or UNC path) matches either the source or destination drive (or UNC path). With the above example the filter C:\*cache*\ is valid as it is using the drive C: which the source also uses.

 

This can be useful when using variables in the filters that have absolute paths. For example, you may be copying everything on your C:\ drive (not recommended) but do not want to copy your Windows or Program Files folders. In that case you could use the following exclude filters:

 

%SystemRoot%\*

%ProgramFiles%\*

%ProgramFiles(x86)%\*

 

 

Example filters for SyncBackPro

 

The filters in SyncBackPro allow for files and folders to be filtered based on their name. There are three filter types to choose from. This section gives examples using DOS Expressions, which is the default filter type and the simplest to use.

First, there are some important rules to remember about filters:

1.The selections in the tree override the filters. For example, you can filter out all .txt files but still select some .txt files in the tree.

2.Exclude filters override include filters. For example, the include filter may be set to * (which means include everything), and your exclude filter could have *\*.temp in it, which means any file with the extension .temp will be excluded.

3.   Filters apply to the entire filename, including the path, but the source and destination base are not part of the path. For example, if your source directory is C:\My Documents\ then that will not be in the filename used with the filter. This makes sense if you remember that the source and destination root directories are different, but their sub-directories are going to have the same names.

4.   Folder names end with a backslash, where as files do not, e.g. \My Documents\ and \My Documents\filename.txt

5.   All file and folder names start with a backslash.

 

Remember to include folders and files in the filter

 

If you set your Files/folders to copy filter to just *\*.txt then it will only include text files in the root folder and unselect all child folders. Why? Because you forgot to also include folders. You need to also add *\ to Files/folders to copy to include all the folders (or change that as appropriate to include only folders with certain names, for example).

Another example is if you set your Files/folders to copy filter to just *\ then it will only include folders and no files. Why? Because all folders end with a backslash (\) but no files do. If you want all folders and files the filter should be * (or *\*)

 

Filters are applied top-down

 

When SyncBackPro scans a folder it starts from the top (the root) and works its way down the child folders. For each file and folder it first looks to see if it has been specifically selected, or not, in the file & folder selection tree. Selections override filters. If no selection decision has been made then it uses the filters. It first checks to see if the file or folder matches any inclusion filter. If not, it is filtered out, i.e. skipped (ignored). If it's a folder that is being filtered out then all files and child folders of that folder are ignored. If it matches the filter then it checks to see if it matches an exclusion filter. If it does then it is filtered out.

For example, say you have the following folder structure:

\
\Parent\
\Parent\Child\
\Parent\Child\GrandChild\

The root folder (\) is always included and cannot be filtered out. After scanning the files in the root folder, it would then scan Parent, then Child, then GrandChild. Each folder must match a filter (or have been selected in the tree) otherwise everything in it is ignored. For example, if you had the following filter to copy all text files in the Child folder then it would fail:

\Child\*.txt

Why would it fail? Two reasons. First, because the Parent folder does not match that filter so the Child folder is never looked at. Second, the Child folder doesn't match that filter (it is \Parent\Child\). Folders end with a backslash. Therefore the filters must be changed to the following so the folders are included:

\Parent\
\Parent\Child\
\Parent\Child\*.txt

 

Example DOS Expressions

 

Notice that many of the examples below also include filters to include folders.

*\
*\*.txt
 

All text files (.txt) in all folders. The *\ filter ensures all folders are looked at.

*\
*\temp\*.txt

All text files in all folders called temp and any sub-folders of those temp folders.

 
\temp\
\temp\*.txt

 
All text files in the root folder called temp. For example, if your source directory is C:\My Documents\ then this filter is for all text files in C\My Documents\temp\

 
*\test\

 
All folders called test. Note that no files will be copied unless another filter is added to include files, e.g. *\*.txt

 
*\parent\
*\parent\child\

 
All folders called child whose parent directory is called parent. Notice the filter *\ is required otherwise it will never look inside folders called parent. Note that no files will be copied unless another filter is added to include files, e.g. *\*.txt

 
\temp*\

 
All root folders whose name starts with temp or is called temp. Note that no files will be copied unless another filter is added to include files, e.g. *\*.txt

 

Examples of wrong DOS Expressions

The examples below are examples of wrong filters. An explanation is given of why it is wrong.

*.txt

This will match any file, or folder, whose name ends with .txt. If you are trying to just include all text files then you should also remember to add *\ to the filters otherwise no child folders will be selected (see the notes below). If you just want text files in the root then the filter is valid if used on its own.
 

temp\*.txt

This filter will fail to match anything because all folder and filenames start with a backslash (\) character.

 

 

 

 

All Content: 2BrightSparks Pte Ltd © 2003-2024