RegExp: Examples for Excluding Matched Patterns

From SEPsesam
Jump to: navigation, search
Other languages:
Deutsch • ‎English

Copyright © SEP AG 1999-2018. All rights reserved.

Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.

Docs latest icon.png Welcome to the latest SEP sesam documentation version 4.4.3. For previous documentation version(s), check Documentation archive.


Introduction

In all of the following examples for excludes using regular expression patterns we assume that the directory to be backed up contains the following sub-directories and files:

# find /backupsource/
./ADirectory1
./ADirectory1/file1
./dir-exclude
./dir-exclude/one
./DIRECTORY12FALL
./DIRECTORY12FALL/file1
./ADirectory2
./ADirectory2/file1
./BDirectory2
./BDirectory2/file1
./BDirectory1
./BDirectory1/file1
./BDirectory1/file2
./1235-Directory1
./1235-Directory1/file1

The backup source is /backupsource/ in every example. The excludes are entered manually into the exclude list (but they can be used in an exclude file).

RegExp exclude.png

The backup job is started with extended logging options (Expert options, -v2) so the files that are excluded can be seen in the log.

RegExp exclude save.png

Directories starting with the letter "A" are to be ignored

"/backupsource/A.*"

Result from the log:

2016-06-30 15:27:30: sbc-3008: Info:     Processing item: [./backupsource/]...
2016-06-30 15:27:30: sbc-3108: Info:     Item processed successfully: [./backupsource/]
2016-06-30 15:27:30: sbc-3014: Info:     Item [./backupsource/ADirectory1] excluded.
2016-06-30 15:27:30: sbc-3014: Info:     Item [./backupsource/ADirectory1/file1] excluded.
2016-06-30 15:27:30: sbc-3008: Info:     Processing item: [./backupsource/dir-exclude]...
2016-06-30 15:27:30: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude]
2016-06-30 15:27:30: sbc-3008: Info:     Processing item: [./backupsource/dir-exclude/one]...
2016-06-30 15:27:30: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude/one]
2016-06-30 15:27:30: sbc-3008: Info:     Processing item: [./backupsource/VERZEICHNIS12FALL]...
2016-06-30 15:27:30: sbc-3108: Info:     Item processed successfully: [./backupsource/DIRECTORY12FALL]
2016-06-30 15:27:30: sbc-3008: Info:     Processing item: [./backupsource/DIRECTORY12FALL/file1]...
2016-06-30 15:27:30: sbc-3108: Info:     Item processed successfully: [./backupsource/DIRECTORY12FALL/file1]
2016-06-30 15:27:30: sbc-3014: Info:     Item [./backupsource/ADirectory2] excluded.
2016-06-30 15:27:30: sbc-3014: Info:     Item [./backupsource/ADirectory/file1] excluded.
2016-06-30 15:27:30: sbc-3008: Info:     Processing item: [./backupsource/BDirectory2]...
2016-06-30 15:27:30: sbc-3108: Info:     Item processed successfully: [./backupsource/BDirectory2]
2016-06-30 15:27:30: sbc-3008: Info:     Processing item: [./backupsource/BDirectory2/file1]...

All files / directories ending with "1" are to be ignored

"/backupsource/.*1$"

Result from the log:

2016-06-30 15:37:50: sbc-3014: Info:     Item [./backupsource/ADirectory1] excluded.
2016-06-30 15:37:50: sbc-3014: Info:     Item [./backupsource/ADirectory1/file1] excluded.
2016-06-30 15:37:50: sbc-3008: Info:     Processing item: [./backupsource/dir-exclude]...
2016-06-30 15:37:50: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude]
2016-06-30 15:37:50: sbc-3014: Info:     Item [./backupsource/BDirectory2/datei1] excluded.
2016-06-30 15:37:50: sbc-3014: Info:     Item [./backupsource/BDirectory1] excluded.
2016-06-30 15:37:50: sbc-3014: Info:     Item [./backupsource/BDirectory1/datei1] excluded.
2016-06-30 15:37:50: sbc-3008: Info:     Processing item: [./backupsource/BDirectory1/file2]...
2016-06-30 15:37:50: sbc-3108: Info:     Item processed successfully: [./backupsource/BDirectory1/file2]
2016-06-30 15:37:50: sbc-3014: Info:     Item [./backupsource/1235-Directory1] excluded.
2016-06-30 15:37:50: sbc-3014: Info:     Item [./backupsource/1235-Directory1/file1] excluded.

All files / directories ending with an arbitrary number are to be ignored

"/backupsource/.*\d$"

Result from the log:

2016-06-30 15:49:45: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude/one]
2016-06-30 15:49:45: sbc-3008: Info:     Processing item: [./backupsource/DIRECTORY12FALL]...
2016-06-30 15:49:45: sbc-3108: Info:     Item processed successfully: [./backupsource/DIRECTORY12FALL]
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/DIRECTORY12FALL/file1] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/ADirectory2] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/ADirectory2/file1] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/BDirectory2] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/BDirectory2/file1] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/BDirectory1] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/BDirectory1/file1] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/BDirectory1/file2] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/1235-Directory1] excluded.
2016-06-30 15:49:45: sbc-3014: Info:     Item [./backupsource/1235-Directory1/file1] excluded.
2016-06-30 15:49:45: sbc-3500: Info:     All hardlinks completely saved.

A directory containing a two digit number is to be ignored

"/backupsource/DIRECTORY(\d\d)FALL"

Result from the log:

2016-06-30 15:54:28: sbc-3008: Info:     Processing item: [./backupsource/dir-exclude]...
2016-06-30 15:54:28: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude]
2016-06-30 15:54:28: sbc-3008: Info:     Processing item: [./backupsource/dir-exclude/one]...
2016-06-30 15:54:28: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude/one]
2016-06-30 15:54:28: sbc-3014: Info:     Item [./backupsource/DIRECTORY12FALL] excluded.
2016-06-30 15:54:28: sbc-3014: Info:     Item [./backupsource/DIRECTORY12FALL/one1] excluded.
2016-06-30 15:54:28: sbc-3008: Info:     Processing item: [./backupsource/ADirectory2]...
2016-06-30 15:54:28: sbc-3108: Info:     Item processed successfully: [./backupsource/ADirectory2]
2016-06-30 15:54:28: sbc-3008: Info:     Processing item: [./backupsource/ADirectory2/one1]...

Directories ending with the string "-exclude" are to be ignored

"/backupsource/.*-exclude"

Results from the log:

2016-06-30 15:32:49: sbc-3008: Info:     Processing item: [./backupsource/ADirectory1/datei1]...
2016-06-30 15:32:49: sbc-3108: Info:     Item processed successfully: [./backupsource/ADirectory1/datei1]
2016-06-30 15:32:49: sbc-3014: Info:     Item [./backupsource/dir-exclude] excluded.
2016-06-30 15:32:49: sbc-3014: Info:     Item [./backupsource/dir-exclude/eins] excluded.
2016-06-30 15:32:49: sbc-3008: Info:     Processing item: [./backupsource/DIRECTORY12FALL]...
2016-06-30 15:32:49: sbc-3108: Info:     Item processed successfully: [./backupsource/DIRECTORY12FALL]

Directories that only contain lower case letters are to be ignored

"/backupsource/[a-z]"
2016-06-30 15:56:48: sbc-3008: Info:     Processing item: [./backupsource/ADirectory1/file1]...
2016-06-30 15:56:48: sbc-3108: Info:     Item processed successfully: [./backupsource/ADirectory1/file1]
2016-06-30 15:56:48: sbc-3014: Info:     Item [./backupsource/dir-exclude] excluded.
2016-06-30 15:56:48: sbc-3014: Info:     Item [./backupsource/dir-exclude/one] excluded.
2016-06-30 15:56:48: sbc-3008: Info:     Processing item: [./backupsource/DIRECTORY12FALL]...
2016-06-30 15:56:48: sbc-3108: Info:     Item processed successfully: [./backupsource/DIRECTORY12FALL]

Directories that contain upper case letters and a two digit number are to be ignored

"/backupsource/[A-Z]+\d\d[A-Z]+"
2016-06-30 16:02:23: sbc-3108: Info:     Item processed successfully: [./backupsource/ADirectory1/file1]
2016-06-30 16:02:23: sbc-3008: Info:     Processing item: [./backupsource/dir-exclude]...
2016-06-30 16:02:23: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude]
2016-06-30 16:02:23: sbc-3008: Info:     Processing item: [./backupsource/dir-exclude/one]...
2016-06-30 16:02:23: sbc-3108: Info:     Item processed successfully: [./backupsource/dir-exclude/one]
2016-06-30 16:02:23: sbc-3014: Info:     Item [./backupsource/DIRECTORY12FALL] excluded.
2016-06-30 16:02:23: sbc-3014: Info:     Item [./backupsource/DIRECTORY12FALL/file1] excluded.
2016-06-30 16:02:23: sbc-3008: Info:     Processing item: [./backupsource/ADirectory2]...
2016-06-30 16:02:23: sbc-3108: Info:     Item processed successfully: [./backupsource/ADirectory2]
2016-06-30 16:02:23: sbc-3008: Info:     Processing item: [./backupsource/ADirectory2/file1]...
2016-06-30 16:02:23: sbc-3108: Info:     Item processed successfully: [./backupsource/ADirectory2/file1]
2016-06-30 16:02:23: sbc-3008: Info:     Processing item: [./backupsource/BDirectory2]..

See also

Creating Exclude List