Source:Examples for Excluding Matched Patterns

From SEPsesam
Revision as of 15:16, 17 June 2022 by Sta (talk | contribs) (Marked this version for translation)
Other languages:

Template:Copyright SEP AG en

Docs latest icon.png Welcome to the latest SEP sesam documentation version 4.4.3/4.4.3 Beefalo V2. 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 subdirectories 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 field (but they can be used in an exclude file). For more information, see Creating Exclude List.

Information sign.png Note
The exclude list on the SEP sesam Linux Client can also be used as an include list by specifying the + (plus) sign at the beginning of a pattern. For details, see Advanced Backup and Restore Options.

RegExp exclude Beefalo V2.jpg

The backup job is started with extended logging level (-v 2) so the files that are excluded can be seen in the log.

RegExp exclude options Beefalo V2.jpg

Examples

Information sign.png Note
When creating exclude lists with regex, pay attention to which SEP sesam version you are using. As of ≥ Jaglion V2 it is possible to use separate excludes for files and directories, which can help in creating more selective excludes.
  • If exclude ends with a trailing slash "/$" (e.g. .tmp/$), it is recognized as a regex for directory exclusion.
  • If there is no trailing slash "/" (e.g. .tmp) at the end, it is recognized as a regex for file exclusion.

The following examples show the regex behavior for v. ≤ Jaglion.

All files and directories starting with the letter "A" are to be ignored

"/backupsource/A.*"

Result from the log:

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

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

"/backupsource/.*1$"

Result from the log:

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

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

"/backupsource/.*\d$"

Result from the log:

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

==

All files and directories containing a two digit number is to be ignored

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

Result from the log:

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

All files and directories ending with the string "-exclude" are to be ignored

"/backupsource/.*-exclude"

Results from the log:

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

All files and directories that only contain lower case letters are to be ignored

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

All files and directories that contain upper case letters and a two digit number are to be ignored

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

See also

Creating Exclude ListExclude with Regular Expressions