Source:Examples for Excluding Matched Patterns

From SEPsesam
Revision as of 09:52, 21 July 2022 by Ee (talk | contribs)
Other languages:

Template:Copyright SEP AG en

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


Introduction

When creating exclude lists with regex, pay attention to which SEP sesam version you are using. As of ≥ Jaglion V2 SP1, 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. ./mnt/$), 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.

This new syntax caused the backup of folders to be ignored if the directories exclusion pattern was not adjusted. SEP has released a hotfix for Jaglion V2 SP1 to revert to the old behavior.

Once you upgrade to ≥ Jaglion V2 SP1, you can use your existing exclude list or decide to customize your exclude lists to use the new syntax for separate exclusions for files and directories (ending with /$). In this case, you have to add the following switch to the backup options in the GUI to distinguish between files and directories using ending "/$": -o excl=regexp_split.

Use-case scenario

In all of the following examples, 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 in each example is /backupsource/. The excludes are entered manually into the exclude list field (but they can also 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 that the excluded files are visible in the log.

RegExp exclude options Beefalo V2.jpg

Examples (old behavior, no distinction between exclude for directories and files)

The following examples show exclusion with regular expression patterns (old behavior, v. ≤ Jaglion) that do not include separate excludes for files and directories. These patterns are still valid as long as the -o excl=regexp_split switch is not used.

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 are 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