Source:Examples for Excluding Matched Patterns/en: Difference between revisions

From SEPsesam
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 4: Line 4:
{{Navigation_latest|release=[[Special:MyLanguage/SEP_sesam_Release_Versions|4.4.3/5.0.0 ''Jaglion'']]|link=[[Special:MyLanguage/SEP_sesam_Documentation#previous|Documentation archive]]}}
{{Navigation_latest|release=[[Special:MyLanguage/SEP_sesam_Release_Versions|4.4.3/5.0.0 ''Jaglion'']]|link=[[Special:MyLanguage/SEP_sesam_Documentation#previous|Documentation archive]]}}


== Introduction ==  
== <!-- Introduction --> Use-case scenario==  
<div class="boilerplate metadata" id="Additional resources" style="background-color: #f0f0f0; color:#636f73; border: 1px ridge #cdd3db; margin: 0.5em; padding: 0.5em; float: right; width:35%; "><center><b>Additional resources</b></center>
<div class="boilerplate metadata" id="Additional resources" style="background-color: #f0f0f0; color:#636f73; border: 1px ridge #cdd3db; margin: 0.5em; padding: 0.5em; float: right; width:35%; "><center><b>Additional resources</b></center>


Line 22: Line 22:
|}</div>
|}</div>


When creating exclude lists with regex, pay attention to which SEP sesam version you are using. As of [[SEP sesam Release Versions|≥ Jaglion V2 SP2]], it is possible to use separate excludes for files and directories, which can be helpful in creating more selective excludes.
<!-- Commented out as this is currently not possible: When creating exclude lists with regex, pay attention to which SEP sesam version you are using. As of [[SEP sesam Release Versions|≥ Jaglion V2 SP2]], it is possible to use separate excludes for files and directories, which can be helpful in creating more selective excludes.


This is the syntax that allows separate excludes for files and directories (with the "regexp_split" option enabled as described below):
This is the syntax that allows separate excludes for files and directories (with the "regexp_split" option enabled as described below):
Line 30: Line 30:
In v. [[SEP sesam Release Versions|≥ Jaglion V2 SP2]],  you can customize your exclude lists to use the new syntax by adding the following switch to the [[Special:MyLanguage/Standard_Backup_Procedure#bck_options|backup options in the GUI]]: <br /><code>-o excl<nowiki>=</nowiki>regexp_split</code>.
In v. [[SEP sesam Release Versions|≥ Jaglion V2 SP2]],  you can customize your exclude lists to use the new syntax by adding the following switch to the [[Special:MyLanguage/Standard_Backup_Procedure#bck_options|backup options in the GUI]]: <br /><code>-o excl<nowiki>=</nowiki>regexp_split</code>.


== {{anchor|scenario}}Use-case scenario ==
== {{anchor|scenario}}Use-case scenario == -->
In all of the following examples, we assume that the directory to be backed up contains the following subdirectories and files:
In all of the following examples, we assume that the directory to be backed up contains the following subdirectories and files:


Line 60: Line 60:
[[File:RegExp_exclude_options_Beefalo_V2.jpg|link=]]
[[File:RegExp_exclude_options_Beefalo_V2.jpg|link=]]


=== {{anchor|examples}}Examples (old behavior, no distinction between exclude for directories and files)  ===
=== {{anchor|examples}}Examples <!--(old behavior, no distinction between exclude for directories and files)--> ===


The following examples show exclusion with regular expression patterns (old behavior, v. [[SEP sesam Release Versions| ≤ Jaglion V2]]) that do not include separate excludes for files and directories. These patterns are still valid as long as the <code>-o excl<nowiki>=</nowiki>regexp_split</code> switch is not used.
<!--
The following examples show exclusion with regular expression patterns (old behavior, v. [[SEP sesam Release Versions| ≤ Jaglion V2]]) that do not include separate excludes for files and directories. These patterns are still valid as long as the <code>-o excl<nowiki>=</nowiki>regexp_split</code> switch is not used.-->


===={{anchor|start}}All files and directories starting with the letter "A" are to be ignored====
===={{anchor|start}}All files and directories starting with the letter "A" are to be ignored====

Revision as of 18:25, 2 August 2022

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.


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

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