2BrightSparks Support Area

Login / Register

User

Pass



Register | Forget pass?

Search KnowledgeBase

 

KnowledgeBase

Main > Frequently Asked Questions > SyncBackPro, SyncBackSE, and SyncBackFree
Minimize Text   Default    Enlarge Text
 

Example filters for SyncBack


Print
Save to list
Subscribe
Created
Modified 2012-12-04
Views 10628
Author

Example filters for SyncBack

The filters in SyncBack allow for files and folders to be filtered based on their name. There are different filter types to choose from (see the Help file for details). This article gives examples using DOS Expressions, which is the default filter type.

First, there are three 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. 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.
  3. Folder names end with a backslash, whereas files do not, e.g. \My Documents\ and \My Documents\filename.txt
  4. 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 add *\ to Files/folders to copy as well 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 files do not. If you want to include all folders and files, the filter should be * (or *\*)

Filters are applied top-down

When SyncBack 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, it then 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

\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 *\parent\ 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.




Related Articles
Checking Profiles after updating from SyncBackSE V3 or SyncBack V3 Freeware to SyncBackFree/SE/Pro V4 or newer
Checking Profiles after updating from SyncBackSE V3 or SyncBack V3 Freeware to SyncBackFree/SE/Pro V4 or newer This article shows how to check your profile/s in...
Cannot see hidden folders when choosing a source or destination folder
Cannot see hidden folders when choosing a source or destination folder To see hidden folders in a folder selection dialog box please follow these steps: - Run Windows...
Files and folders I did not select are being included in my profile. Why and how do I change it?
Q: Files and folders I did not select are being included in my profile. Why and how do I change it? By default profiles will automatically include all new files and...
 

 

2BrightSparks Copyright 2003-2013 | Homepage | Sitemap | Support | Forum