diff --git a/HISTORY b/HISTORY index 139b08d1..34669760 100644 --- a/HISTORY +++ b/HISTORY @@ -3,6 +3,10 @@ SnapRAID HISTORY 13.1 WIP ======== + * Added support for local exclusion rules via .snapraidignore files placed + directly within the array directory tree. This allows for granular, + directory-level control over which files and folders are excluded from + parity, mirroring the workflow of .gitignore. * Added detection of the smartctl executable. Improves reliability when running under sudo or in environments where /sbin and /usr/sbin are not in PATH. * Avoided saving the content file when it was not strictly necessary. diff --git a/TODO b/TODO index 38b1f42f..876a3f25 100644 --- a/TODO +++ b/TODO @@ -5,53 +5,6 @@ This is the list of TODO items for SnapRAID. - Next -* Distributed Exclusion Support (.snapraidignore) -See https://sourceforge.net/p/snapraid/discussion/1677233/thread/09ed63eca7/?limit=25#d058 - -Support decentralized exclusion rules by allowing users to place ignore files -deeper in the directory tree. This mirrors the behavior of .gitignore but -maintains the strict pathing logic of SnapRAID. - -1. FILE NAME & PLACEMENT -* FILENAME: .snapraidignore -* WHY: Avoids naming conflict with Ubuntu's "snap" application ecosystem. -* PLACEMENT: Any directory within the array. - -2. COMPARISON WITH .GITIGNORE -* Anchor (/): Both anchor to the local directory where the file resides. -* Folder Logic: SnapRAID is STRICT (must end in /). Git is AMBIGUOUS. -* File Logic: SnapRAID is STRICT (no / targets files). Git matches both. -* Recursive Search: Both match in current folder and all subfolders. -* Negation (!): SnapRAID does NOT SUPPORT. Git supports. -* Globbing: Both support *, ?, [a-z]. Git adds **. - -3. PATTERN RULES (INTEGRATION WITH EXISTING SYNTAX) -Patterns inside .snapraidignore are treated as relative to the file location: - - FILE Selects any file named FILE in this directory or below. - DIR/ Selects any directory named DIR and its contents in this - directory or below. - /PATH/FILE Selects the exact specified file relative to the - .snapraidignore location. - /PATH/DIR/ Selects the exact specified directory relative to the - .snapraidignore location. - -4. EXAMPLES -If .snapraidignore is placed in: /mnt/disk1/projects/ - - /output.bin -> Ignores ONLY /mnt/disk1/projects/output.bin - build/ -> Ignores any folder named 'build' inside projects/ - *.tmp -> Ignores any .tmp file inside projects/ or its subfolders - -5. IMPLEMENTATION NOTES -* PERFORMANCE: No significant overhead. SnapRAID already performs a full - directory traversal during sync/diff; it just needs to check for the presence - of .snapraidignore in the current DIR handle. -* PRECEDENCE: Exclusions are additive. If a file is excluded by EITHER the - global snapraid.conf OR any local .snapraidignore in its path, it is excluded. -* SCOPE: A .snapraidignore file affects its parent directory and all - subdirectories beneath it. - * Integration with MergeFS ? * Support BTRFS subvolumes. Keep track of the subvolumeid, along with the inode, and use it when searching/comparing inodes. diff --git a/cmdline/elem.c b/cmdline/elem.c index 1e2fd08b..e6640cac 100644 --- a/cmdline/elem.c +++ b/cmdline/elem.c @@ -42,7 +42,7 @@ void content_free(struct snapraid_content* content) free(content); } -struct snapraid_filter* filter_alloc_file(int direction, const char* pattern) +struct snapraid_filter* filter_alloc_file(int direction, const char* root, const char* pattern) { struct snapraid_filter* filter; char* i; @@ -53,11 +53,13 @@ struct snapraid_filter* filter_alloc_file(int direction, const char* pattern) filter = malloc_nofail(sizeof(struct snapraid_filter)); pathimport(filter->pattern, sizeof(filter->pattern), pattern); + pathimport(filter->root, sizeof(filter->root), root); filter->direction = direction; /* find first and last slash */ first = 0; last = 0; + /* reject invalid tokens, like "", ".", ".." and more dots */ token_is_valid = 0; token_is_filled = 0; @@ -145,7 +147,7 @@ struct snapraid_filter* filter_alloc_disk(int direction, const char* pattern) return filter; } -void filter_free(struct snapraid_filter* filter) +void filter_free(void* filter) { free(filter); } @@ -200,9 +202,16 @@ static int filter_recurse(struct snapraid_filter* filter, struct snapraid_filter char* name; unsigned i; + if (filter->root[0] != 0) { /* if it's a local filter */ + if (!path_is_root_of(filter->root, const_path)) /* applies it only if it matches the root */ + return 0; + /* advance the path to compare to make it local */ + const_path += strlen(filter->root); + } + pathcpy(path, sizeof(path), const_path); - /* filter for all the directories */ + /* filter all the dir/subdir until we reach the final file/dir */ name = path; for (i = 0; path[i] != 0; ++i) { if (path[i] == '/') { @@ -221,7 +230,7 @@ static int filter_recurse(struct snapraid_filter* filter, struct snapraid_filter } } - /* filter the final file */ + /* filter the final file/dir */ if (filter_apply(filter, reason, path, name, is_dir) != 0) return filter->direction; @@ -232,7 +241,7 @@ static int filter_element(tommy_list* filterlist, struct snapraid_filter** reaso { tommy_node* i; - int direction = 1; /* by default include all */ + int default_direction = 1; /* by default include all */ /* for each filter */ for (i = tommy_list_head(filterlist); i != 0; i = i->next) { @@ -256,10 +265,10 @@ static int filter_element(tommy_list* filterlist, struct snapraid_filter** reaso } else if (ret < 0) { /* exclude the file */ return -1; - } else { - /* default is opposite of the last filter */ - direction = -filter->direction; - if (reason != 0 && direction < 0) + } else if (filter->root[0] == 0) { + /* default is opposite of the last global rule (not counting local rules) */ + default_direction = -filter->direction; + if (reason != 0 && default_direction < 0) *reason = filter; /* continue with the next one */ } @@ -270,8 +279,8 @@ static int filter_element(tommy_list* filterlist, struct snapraid_filter** reaso if (is_def_include) return 0; - /* files are excluded/included depending of the last rule processed */ - if (direction < 0) + /* files are excluded/included depending of the last rule processed (not counting local filters) */ + if (default_direction < 0) return -1; return 0; diff --git a/cmdline/elem.h b/cmdline/elem.h index be54bd2f..4d3dc2b7 100644 --- a/cmdline/elem.h +++ b/cmdline/elem.h @@ -60,9 +60,10 @@ struct snapraid_content { */ struct snapraid_filter { char pattern[PATH_MAX]; /**< Filter pattern. */ - int is_disk; /**< If the pattern is a disk one. */ - int is_path; /**< If the pattern is only for the complete path. */ - int is_dir; /**< If the pattern is only for dir. */ + char root[PATH_MAX]; /**< If empty, it's a global pattern. If not empty, it's a local pattern that applies only to that dir. */ + int is_disk; /**< If the pattern is a disk one, otherwise it's a file pattern */ + int is_path; /**< If the pattern is a complete path, otherwise it's just a file name */ + int is_dir; /**< If the pattern is only for dir, otherwise it's only for file. */ int direction; /**< If it's an inclusion (=1) or an exclusion (=-1). */ tommy_node node; /**< Next node in the list. */ }; @@ -374,7 +375,7 @@ struct snapraid_disk { /** * Mutex for protecting the scan process. * - * It's used during the scan process to protect the stampset to identity copy of files + * It's used during the scan process to protect the stampset to identify copy of files */ thread_mutex_t stamp_mutex; #endif @@ -500,7 +501,7 @@ void content_free(struct snapraid_content* content); /** * Allocate a filter pattern for files and directories. */ -struct snapraid_filter* filter_alloc_file(int is_include, const char* pattern); +struct snapraid_filter* filter_alloc_file(int is_include, const char* root, const char* pattern); /** * Allocate a filter pattern for disks. @@ -510,7 +511,7 @@ struct snapraid_filter* filter_alloc_disk(int is_include, const char* pattern); /** * Deallocate an exclusion. */ -void filter_free(struct snapraid_filter* filter); +void filter_free(void* filter); /** * Filter type description. diff --git a/cmdline/scan.c b/cmdline/scan.c index e81de8ea..9d03dac0 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -51,6 +51,7 @@ struct snapraid_scan { tommy_list file_insert_list; /**< Files to insert. */ tommy_list link_insert_list; /**< Links to insert. */ tommy_list dir_insert_list; /**< Dirs to insert. */ + tommy_list local_filter_list; /**< Filter list specific for the disk. */ /* nodes for data structures */ tommy_node node; @@ -73,6 +74,7 @@ static struct snapraid_scan* scan_alloc(struct snapraid_state* state, struct sna tommy_list_init(&scan->file_insert_list); tommy_list_init(&scan->link_insert_list); tommy_list_init(&scan->dir_insert_list); + tommy_list_init(&scan->local_filter_list); scan->is_diff = is_diff; scan->need_write = 0; @@ -88,7 +90,7 @@ static void scan_free(struct snapraid_scan* scan) #if HAVE_THREAD thread_mutex_destroy(&scan->disk->stamp_mutex); #endif - + tommy_list_foreach(&scan->local_filter_list, filter_free); free(scan); } @@ -1346,6 +1348,10 @@ static int scan_sub(struct snapraid_scan* scan, int level, int is_diff, char* pa /* insert in the list */ tommy_list_insert_tail(&list, &entry->node, entry); + + /* process ignore files */ + if (strcmp(".snapraidignore", dd->d_name) == 0) + state_load_ignore_file(&scan->local_filter_list, path_next, sub_next); } if (closedir(d) != 0) { @@ -1434,7 +1440,8 @@ static int scan_sub(struct snapraid_scan* scan, int level, int is_diff, char* pa } if (type == 0) { /* REG */ - if (filter_path(&state->filterlist, &reason, disk->name, sub_next) == 0) { + if (filter_path(&state->filterlist, &reason, disk->name, sub_next) == 0 + && filter_path(&scan->local_filter_list, &reason, disk->name, sub_next) == 0) { /* late stat, if not yet called */ if (!st) @@ -1459,7 +1466,8 @@ static int scan_sub(struct snapraid_scan* scan, int level, int is_diff, char* pa msg_verbose("Excluding file '%s' for rule '%s'\n", path_next, filter_type(reason, tmp, PATH_MAX)); } } else if (type == 1) { /* LNK */ - if (filter_path(&state->filterlist, &reason, disk->name, sub_next) == 0) { + if (filter_path(&state->filterlist, &reason, disk->name, sub_next) == 0 + && filter_path(&scan->local_filter_list, &reason, disk->name, sub_next) == 0) { int ret; ret = readlink(path_next, tmp, PATH_MAX); @@ -1488,7 +1496,8 @@ static int scan_sub(struct snapraid_scan* scan, int level, int is_diff, char* pa msg_verbose("Excluding link '%s' for rule '%s'\n", path_next, filter_type(reason, tmp, PATH_MAX)); } } else if (type == 2) { /* DIR */ - if (filter_subdir(&state->filterlist, &reason, disk->name, sub_next) == 0) { + if (filter_subdir(&state->filterlist, &reason, disk->name, sub_next) == 0 + && filter_subdir(&scan->local_filter_list, &reason, disk->name, sub_next) == 0) { #ifndef _WIN32 /* late stat, if not yet called */ if (!st) @@ -1517,7 +1526,8 @@ static int scan_sub(struct snapraid_scan* scan, int level, int is_diff, char* pa msg_verbose("Excluding directory '%s' for rule '%s'\n", path_next, filter_type(reason, tmp, PATH_MAX)); } } else { - if (filter_path(&state->filterlist, &reason, disk->name, sub_next) == 0) { + if (filter_path(&state->filterlist, &reason, disk->name, sub_next) == 0 + && filter_path(&scan->local_filter_list, &reason, disk->name, sub_next) == 0) { /* late stat, if not yet called */ if (!st) st = DSTAT(path_next, dd, &st_buf); diff --git a/cmdline/snapraid.c b/cmdline/snapraid.c index 0a2a7f66..e1d990d5 100644 --- a/cmdline/snapraid.c +++ b/cmdline/snapraid.c @@ -996,7 +996,7 @@ int snapraid_main(int argc, char* argv[]) pathimport(conf, sizeof(conf), optarg); break; case 'f' : { - struct snapraid_filter* filter = filter_alloc_file(1, optarg); + struct snapraid_filter* filter = filter_alloc_file(1, "", optarg); if (!filter) { /* LCOV_EXCL_START */ log_fatal("Invalid filter specification '%s'\n", optarg); diff --git a/cmdline/state.c b/cmdline/state.c index 7c69e5ac..4edb6c8a 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -1230,7 +1230,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co /* LCOV_EXCL_STOP */ } - filter = filter_alloc_file(-1, buffer); + filter = filter_alloc_file(-1, "", buffer); if (!filter) { /* LCOV_EXCL_START */ log_fatal("Invalid 'exclude' specification '%s' in '%s' at line %u\n", buffer, path, line); @@ -1257,7 +1257,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co /* LCOV_EXCL_STOP */ } - filter = filter_alloc_file(1, buffer); + filter = filter_alloc_file(1, "", buffer); if (!filter) { /* LCOV_EXCL_START */ log_fatal("Invalid 'include' specification '%s' in '%s' at line %u\n", buffer, path, line); @@ -5113,3 +5113,71 @@ int state_flush(struct snapraid_state* state, struct snapraid_io* io, struct sna return 0; } +void state_load_ignore_file(tommy_list* filter_list, const char* path, const char* sub) +{ + STREAM* f; + int line; + + f = sopen_read(path, 0); + if (!f) { + /* LCOV_EXCL_START */ + log_error("Error opening the ignore file '%s'. %s.\n", path, strerror(errno)); + /* LCOV_EXCL_STOP */ + } + + line = 1; + while (1) { + char buffer[PATH_MAX]; + int ret; + int c; + + /* skip initial spaces */ + sgetspace(f); + + /* get the whole line */ + ret = sgetline(f, buffer, sizeof(buffer)); + if (ret < 0) { + /* LCOV_EXCL_START */ + log_error("Too long line in '%s' at line %u\n", path, line); + /* LCOV_EXCL_STOP */ + } + + if (buffer[0] == 0) { + /* allow empty lines */ + } else if (buffer[0] == '#') { + /* ignore comment lines */ + } else { + struct snapraid_filter* filter; + + filter = filter_alloc_file(-1, sub, buffer); + if (!filter) { + /* LCOV_EXCL_START */ + log_error("Invalid ignore specification '%s' in '%s' at line %u\n", buffer, path, line); + /* LCOV_EXCL_STOP */ + } + + tommy_list_insert_tail(filter_list, &filter->node, filter); + } + + /* next line */ + c = sgeteol(f); + if (c == EOF) { + break; + } + if (c != '\n') { + /* LCOV_EXCL_START */ + log_error("Extra data in '%s' at line %u\n", path, line); + /* LCOV_EXCL_STOP */ + } + ++line; + } + + if (serror(f)) { + /* LCOV_EXCL_START */ + log_error("Error reading the ignore file '%s' at line %u\n", path, line); + /* LCOV_EXCL_STOP */ + } + + sclose(f); +} + diff --git a/cmdline/state.h b/cmdline/state.h index e743ff45..1fcf1e74 100644 --- a/cmdline/state.h +++ b/cmdline/state.h @@ -403,6 +403,11 @@ void state_thermal_cooldown(struct snapraid_state* state); */ int state_thermal_begin(struct snapraid_state* state, time_t now); +/** + * Load the ignore file .snapraidignore + */ +void state_load_ignore_file(tommy_list* filter_list, const char* path, const char* sub); + /****************************************************************************/ /* misc */ diff --git a/cmdline/support.c b/cmdline/support.c index 9e9c1030..6ba4bbc7 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -911,8 +911,8 @@ void pathimport(char* dst, size_t size, const char* src) pathcpy(dst, size, src); #ifdef _WIN32 - /* convert the Windows dir separator '\' to C '/', */ - /* and the Windows escaping char '^' to the fnmatch '\' */ + /* convert the Windows dir separator '\' to C '/', */ + /* and the Windows escaping char '^' to the fnmatch '\' */ while (*dst) { switch (*dst) { case '\\' : @@ -1013,6 +1013,30 @@ int pathcmp(const char* a, const char* b) #endif } +int path_is_root_of(const char* root, const char* path) +{ + while (*root && *path) { +#ifdef _WIN32 + /* case insensitive compare in Windows */ + char r = tolower((unsigned char)*root); + char p = tolower((unsigned char)*path); + if (r == '\\') + r = '/'; + if (p == '\\') + p = '/'; + if (r != p) + return 0; +#else + if (*root != *path) + return 0; +#endif + ++root; + ++path; + } + + return *root == 0 && *path != 0; +} + /****************************************************************************/ /* file-system */ diff --git a/cmdline/support.h b/cmdline/support.h index aa60dea3..17462ecb 100644 --- a/cmdline/support.h +++ b/cmdline/support.h @@ -352,6 +352,15 @@ void pathcut(char* dst); */ int pathcmp(const char* a, const char* b); +/** + * Check if the root is matching the start of the specified path. + * + * The root MUST end with a /. + * + * In Windows it's case insensitive and assumes \ equal at /. + */ +int path_is_root_of(const char* root, const char* path); + /****************************************************************************/ /* file-system */ diff --git a/doc/snapraid-de.1 b/doc/snapraid-de.1 index 77ed8f8c..f40ec1c8 100644 --- a/doc/snapraid-de.1 +++ b/doc/snapraid-de.1 @@ -1979,6 +1979,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP Unter Unix müssen Sie Globbing\-Zeichen in der Befehlszeile in Anführungszeichen setzen, um zu verhindern, dass die Shell sie erweitert. +.SH DATEIEN IGNORIEREN +Zusätzlich zu den globalen Regeln in der Konfigurationsdatei können Sie +\`.snapraidignore\`\-Dateien in jedem Verzeichnis innerhalb des Arrays platzieren, +um dezentrale Ausschlussregeln zu definieren. +.PP +Regeln, die in \`.snapraidignore\` definiert sind, werden nach den Regeln in der +Konfigurationsdatei angewendet. Dies bedeutet, dass sie eine höhere Priorität haben +und verwendet werden können, um Dateien auszuschließen, die zuvor durch die globale +Konfiguration eingeschlossen wurden. Effektiv wird eine Datei ausgeschlossen, wenn +eine lokale Regel zutrifft, unabhängig von den globalen Include\-Einstellungen. +.PP +Die Musterlogik in \`.snapraidignore\` spiegelt die globale Konfiguration wider, +verankert die Muster jedoch an dem Verzeichnis, in dem sich die Datei befindet: +.TP +.B FILE +Wählt jede Datei namens FILE in diesem Verzeichnis oder darunter aus. +Dies folgt denselben Globbing\-Regeln wie das globale Muster. +.TP +.B DIR/ +Wählt jedes Verzeichnis namens DIR und alles darin aus, das sich +in diesem Verzeichnis oder darunter befindet. +.TP +.B /PATH/FILE +Wählt die exakt angegebene Datei relativ zum Speicherort +der \`.snapraidignore\`\-Datei aus. +.TP +.B /PATH/DIR/ +Wählt das exakt angegebene Verzeichnis und alles darin aus, +relativ zum Speicherort der \`.snapraidignore\`\-Datei. +.PP +Im Gegensatz zur globalen Konfiguration unterstützen \`.snapraidignore\`\-Dateien nur +Ausschlussregeln; Sie können keine \`include\`\-Muster oder Negationen (!) verwenden. +.PP +Wenn Sie beispielsweise eine \`.snapraidignore\` in \`/mnt/disk1/projects/\` haben: +.PP +.RS 4 +# Schließt NUR /mnt/disk1/projects/output.bin aus +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Schließt jedes Verzeichnis namens \'build\' innerhalb von projects/ aus +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Schließt jede .tmp\-Datei innerhalb von projects/ oder deren Unterordnern aus +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID speichert die Liste und Prüfsummen Ihrer Dateien in der Content\-Datei. diff --git a/doc/snapraid-de.d b/doc/snapraid-de.d index 12aa9870..e43eec57 100644 --- a/doc/snapraid-de.d +++ b/doc/snapraid-de.d @@ -1529,6 +1529,48 @@ Pattern Unter Unix müssen Sie Globbing-Zeichen in der Befehlszeile in Anführungszeichen setzen, um zu verhindern, dass die Shell sie erweitert. +Dateien Ignorieren + Zusätzlich zu den globalen Regeln in der Konfigurationsdatei können Sie + `.snapraidignore`-Dateien in jedem Verzeichnis innerhalb des Arrays platzieren, + um dezentrale Ausschlussregeln zu definieren. + + Regeln, die in `.snapraidignore` definiert sind, werden nach den Regeln in der + Konfigurationsdatei angewendet. Dies bedeutet, dass sie eine höhere Priorität haben + und verwendet werden können, um Dateien auszuschließen, die zuvor durch die globale + Konfiguration eingeschlossen wurden. Effektiv wird eine Datei ausgeschlossen, wenn + eine lokale Regel zutrifft, unabhängig von den globalen Include-Einstellungen. + + Die Musterlogik in `.snapraidignore` spiegelt die globale Konfiguration wider, + verankert die Muster jedoch an dem Verzeichnis, in dem sich die Datei befindet: + + =FILE + Wählt jede Datei namens FILE in diesem Verzeichnis oder darunter aus. + Dies folgt denselben Globbing-Regeln wie das globale Muster. + + =DIR/ + Wählt jedes Verzeichnis namens DIR und alles darin aus, das sich + in diesem Verzeichnis oder darunter befindet. + + =/PATH/FILE + Wählt die exakt angegebene Datei relativ zum Speicherort + der `.snapraidignore`-Datei aus. + + =/PATH/DIR/ + Wählt das exakt angegebene Verzeichnis und alles darin aus, + relativ zum Speicherort der `.snapraidignore`-Datei. + + Im Gegensatz zur globalen Konfiguration unterstützen `.snapraidignore`-Dateien nur + Ausschlussregeln; Sie können keine `include`-Muster oder Negationen (!) verwenden. + + Wenn Sie beispielsweise eine `.snapraidignore` in `/mnt/disk1/projects/` haben: + + :# Schließt NUR /mnt/disk1/projects/output.bin aus + :/output.bin + :# Schließt jedes Verzeichnis namens 'build' innerhalb von projects/ aus + :build/ + :# Schließt jede .tmp-Datei innerhalb von projects/ oder deren Unterordnern aus + :*.tmp + Content SnapRAID speichert die Liste und Prüfsummen Ihrer Dateien in der Content-Datei. diff --git a/doc/snapraid-de.txt b/doc/snapraid-de.txt index f59b4ae4..910bdea1 100644 --- a/doc/snapraid-de.txt +++ b/doc/snapraid-de.txt @@ -1629,8 +1629,53 @@ Unter Unix müssen Sie Globbing-Zeichen in der Befehlszeile in Anführungszeichen setzen, um zu verhindern, dass die Shell sie erweitert. -9 CONTENT -========= +9 DATEIEN IGNORIEREN +==================== + +Zusätzlich zu den globalen Regeln in der Konfigurationsdatei können Sie +`.snapraidignore`-Dateien in jedem Verzeichnis innerhalb des Arrays platzieren, +um dezentrale Ausschlussregeln zu definieren. + +Regeln, die in `.snapraidignore` definiert sind, werden nach den Regeln in der +Konfigurationsdatei angewendet. Dies bedeutet, dass sie eine höhere Priorität haben +und verwendet werden können, um Dateien auszuschließen, die zuvor durch die globale +Konfiguration eingeschlossen wurden. Effektiv wird eine Datei ausgeschlossen, wenn +eine lokale Regel zutrifft, unabhängig von den globalen Include-Einstellungen. + +Die Musterlogik in `.snapraidignore` spiegelt die globale Konfiguration wider, +verankert die Muster jedoch an dem Verzeichnis, in dem sich die Datei befindet: + + FILE + Wählt jede Datei namens FILE in diesem Verzeichnis oder darunter aus. + Dies folgt denselben Globbing-Regeln wie das globale Muster. + + DIR/ + Wählt jedes Verzeichnis namens DIR und alles darin aus, das sich + in diesem Verzeichnis oder darunter befindet. + + /PATH/FILE + Wählt die exakt angegebene Datei relativ zum Speicherort + der `.snapraidignore`-Datei aus. + + /PATH/DIR/ + Wählt das exakt angegebene Verzeichnis und alles darin aus, + relativ zum Speicherort der `.snapraidignore`-Datei. + +Im Gegensatz zur globalen Konfiguration unterstützen `.snapraidignore`-Dateien nur +Ausschlussregeln; Sie können keine `include`-Muster oder Negationen (!) verwenden. + +Wenn Sie beispielsweise eine `.snapraidignore` in `/mnt/disk1/projects/` haben: + + # Schließt NUR /mnt/disk1/projects/output.bin aus + /output.bin + # Schließt jedes Verzeichnis namens 'build' innerhalb von projects/ aus + build/ + # Schließt jede .tmp-Datei innerhalb von projects/ oder deren Unterordnern aus + *.tmp + + +10 CONTENT +========== SnapRAID speichert die Liste und Prüfsummen Ihrer Dateien in der Content-Datei. @@ -1643,7 +1688,7 @@ Diese Datei wird von den Befehlen `sync` und `scrub` gelesen und geschrieben und von den Befehlen `fix`, `check` und `status` gelesen. -10 PARITY +11 PARITY ========= SnapRAID speichert die Paritätsinformationen Ihres Arrays in den @@ -1656,7 +1701,7 @@ Diese Dateien werden von den Befehlen `sync` und `fix` gelesen und geschrieben und nur von den Befehlen `scrub` und `check` gelesen. -11 ENCODING +12 ENCODING =========== SnapRAID ignoriert unter Unix jede Kodierung. Es liest und speichert @@ -1674,13 +1719,13 @@ die Konsolenausgabe in eine Datei umleiten, ist die resultierende Datei immer im UTF-8-Format. -12 COPYRIGHT +13 COPYRIGHT ============ Diese Datei ist Copyright (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-es.1 b/doc/snapraid-es.1 index d2f970cb..93370dcb 100644 --- a/doc/snapraid-es.1 +++ b/doc/snapraid-es.1 @@ -1927,6 +1927,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP En Unix, al usar caracteres globbing en la línea de comandos, debe ponerlos entre comillas para evitar que el shell los expanda. +.SH IGNORAR ARCHIVOS +Además de las reglas globales en el archivo de configuración, puedes +colocar archivos \`.snapraidignore\` en cualquier directorio dentro del array +para definir reglas de exclusión descentralizadas. +.PP +Las reglas definidas en \`.snapraidignore\` se aplican después de las reglas del +archivo de configuración. Esto significa que tienen una prioridad más alta y pueden +usarse para excluir archivos que fueron incluidos previamente por la configuración +global. Efectivamente, si una regla local coincide, el archivo se excluye +independientemente de los ajustes de inclusión globales. +.PP +La lógica de patrones en \`.snapraidignore\` refleja la configuración global +pero ancla los patrones al directorio donde se encuentra el archivo: +.TP +.B FILE +Selecciona cualquier archivo llamado FILE en este directorio o por debajo. +Esto sigue las mismas reglas de globbing que el patrón global. +.TP +.B DIR/ +Selecciona cualquier directorio llamado DIR y todo su contenido, +ubicado en este directorio o por debajo. +.TP +.B /PATH/FILE +Selecciona el archivo exacto especificado relativo a la ubicación +del archivo \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Selecciona el directorio exacto especificado y todo su contenido, +relativo a la ubicación del archivo \`.snapraidignore\`. +.PP +A diferencia de la configuración global, los archivos \`.snapraidignore\` solo admiten +reglas de exclusión; no se pueden usar patrones \`include\` o negación (!). +.PP +Por ejemplo, si tienes un \`.snapraidignore\` en \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Excluye SOLO /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Excluye cualquier directorio llamado \'build\' dentro de projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Excluye cualquier archivo .tmp dentro de projects/ o sus subcarpetas +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID almacena la lista y las sumas de comprobación de sus archivos en el archivo de contenido. diff --git a/doc/snapraid-es.d b/doc/snapraid-es.d index db2053a5..fa767f4e 100644 --- a/doc/snapraid-es.d +++ b/doc/snapraid-es.d @@ -1488,6 +1488,48 @@ Pattern En Unix, al usar caracteres globbing en la línea de comandos, debe ponerlos entre comillas para evitar que el shell los expanda. +Ignorar Archivos + Además de las reglas globales en el archivo de configuración, puedes + colocar archivos `.snapraidignore` en cualquier directorio dentro del array + para definir reglas de exclusión descentralizadas. + + Las reglas definidas en `.snapraidignore` se aplican después de las reglas del + archivo de configuración. Esto significa que tienen una prioridad más alta y pueden + usarse para excluir archivos que fueron incluidos previamente por la configuración + global. Efectivamente, si una regla local coincide, el archivo se excluye + independientemente de los ajustes de inclusión globales. + + La lógica de patrones en `.snapraidignore` refleja la configuración global + pero ancla los patrones al directorio donde se encuentra el archivo: + + =FILE + Selecciona cualquier archivo llamado FILE en este directorio o por debajo. + Esto sigue las mismas reglas de globbing que el patrón global. + + =DIR/ + Selecciona cualquier directorio llamado DIR y todo su contenido, + ubicado en este directorio o por debajo. + + =/PATH/FILE + Selecciona el archivo exacto especificado relativo a la ubicación + del archivo `.snapraidignore`. + + =/PATH/DIR/ + Selecciona el directorio exacto especificado y todo su contenido, + relativo a la ubicación del archivo `.snapraidignore`. + + A diferencia de la configuración global, los archivos `.snapraidignore` solo admiten + reglas de exclusión; no se pueden usar patrones `include` o negación (!). + + Por ejemplo, si tienes un `.snapraidignore` en `/mnt/disk1/projects/`: + + :# Excluye SOLO /mnt/disk1/projects/output.bin + :/output.bin + :# Excluye cualquier directorio llamado 'build' dentro de projects/ + :build/ + :# Excluye cualquier archivo .tmp dentro de projects/ o sus subcarpetas + :*.tmp + Content SnapRAID almacena la lista y las sumas de comprobación de sus archivos en el archivo de contenido. diff --git a/doc/snapraid-es.txt b/doc/snapraid-es.txt index 5e2ac292..342c226b 100644 --- a/doc/snapraid-es.txt +++ b/doc/snapraid-es.txt @@ -1588,8 +1588,53 @@ En Unix, al usar caracteres globbing en la línea de comandos, debe ponerlos entre comillas para evitar que el shell los expanda. -9 CONTENT -========= +9 IGNORAR ARCHIVOS +================== + +Además de las reglas globales en el archivo de configuración, puedes +colocar archivos `.snapraidignore` en cualquier directorio dentro del array +para definir reglas de exclusión descentralizadas. + +Las reglas definidas en `.snapraidignore` se aplican después de las reglas del +archivo de configuración. Esto significa que tienen una prioridad más alta y pueden +usarse para excluir archivos que fueron incluidos previamente por la configuración +global. Efectivamente, si una regla local coincide, el archivo se excluye +independientemente de los ajustes de inclusión globales. + +La lógica de patrones en `.snapraidignore` refleja la configuración global +pero ancla los patrones al directorio donde se encuentra el archivo: + + FILE + Selecciona cualquier archivo llamado FILE en este directorio o por debajo. + Esto sigue las mismas reglas de globbing que el patrón global. + + DIR/ + Selecciona cualquier directorio llamado DIR y todo su contenido, + ubicado en este directorio o por debajo. + + /PATH/FILE + Selecciona el archivo exacto especificado relativo a la ubicación + del archivo `.snapraidignore`. + + /PATH/DIR/ + Selecciona el directorio exacto especificado y todo su contenido, + relativo a la ubicación del archivo `.snapraidignore`. + +A diferencia de la configuración global, los archivos `.snapraidignore` solo admiten +reglas de exclusión; no se pueden usar patrones `include` o negación (!). + +Por ejemplo, si tienes un `.snapraidignore` en `/mnt/disk1/projects/`: + + # Excluye SOLO /mnt/disk1/projects/output.bin + /output.bin + # Excluye cualquier directorio llamado 'build' dentro de projects/ + build/ + # Excluye cualquier archivo .tmp dentro de projects/ o sus subcarpetas + *.tmp + + +10 CONTENT +========== SnapRAID almacena la lista y las sumas de comprobación de sus archivos en el archivo de contenido. @@ -1602,7 +1647,7 @@ Este archivo es leído y escrito por los comandos `sync` y `scrub` y leído por los comandos `fix`, `check` y `status`. -10 PARITY +11 PARITY ========= SnapRAID almacena la información de paridad de su array en los @@ -1615,7 +1660,7 @@ Estos archivos son leídos y escritos por los comandos `sync` y `fix` y solo leídos por los comandos `scrub` y `check`. -11 ENCODING +12 ENCODING =========== SnapRAID en Unix ignora cualquier codificación. Lee y almacena los @@ -1633,13 +1678,13 @@ archivo impresos; si redirige la salida de la consola a un archivo, el archivo resultante siempre está en formato UTF-8. -12 COPYRIGHT +13 COPYRIGHT ============ Este archivo es Copyright (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-fr.1 b/doc/snapraid-fr.1 index 106ab7c0..14ae1357 100644 --- a/doc/snapraid-fr.1 +++ b/doc/snapraid-fr.1 @@ -1973,6 +1973,66 @@ snapraid \-f \[dq]*.mp3\[dq] check Sous Unix, lorsque vous utilisez des caractères de globbing sur la ligne de commande, vous devez les mettre entre guillemets pour empêcher le shell de les développer. +.SH IGNORER DES FICHIERS (IGNORE FILES) +En plus des règles globales du fichier de configuration, vous pouvez +placer des fichiers \`.snapraidignore\` dans n\'importe quel répertoire de la grappe +pour définir des règles d\'exclusion décentralisées. +.PP +Les règles définies dans \`.snapraidignore\` sont appliquées après les règles du +fichier de configuration. Cela signifie qu\'elles ont une priorité plus élevée et peuvent +être utilisées pour exclure des fichiers qui étaient précédemment inclus par la +configuration globale. En pratique, si une règle locale correspond, le fichier est +exclu quels que soient les paramètres d\'inclusion globaux. +.PP +La logique des motifs dans \`.snapraidignore\` reflète la configuration globale +mais ancre les motifs au répertoire où se trouve le fichier : +.TP +.B FILE +Sélectionne n\'importe quel fichier nommé FILE dans ce répertoire ou en dessous. +Cela suit les mêmes règles de globbing que le motif global. +.TP +.B DIR/ +Sélectionne n\'importe quel répertoire nommé DIR et tout son contenu, +résidant dans ce répertoire ou en dessous. +.TP +.B /PATH/FILE +Sélectionne le fichier exact spécifié par rapport à l\'emplacement +du fichier \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Sélectionne le répertoire exact spécifié et tout son contenu, +par rapport à l\'emplacement du fichier \`.snapraidignore\`. +.PP +Contrairement à la configuration globale, les fichiers \`.snapraidignore\` ne prennent +en charge que les règles d\'exclusion ; vous ne pouvez pas utiliser de motifs \`include\` ou de négation (!). +.PP +Par exemple, si vous avez un \`.snapraidignore\` dans \`/mnt/disk1/projects/\` : +.PP +.RS 4 +# Exclut UNIQUEMENT /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Exclut tout répertoire nommé \'build\' dans projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Exclut tout fichier .tmp dans projects/ ou ses sous\-dossiers +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENU (CONTENT) SnapRAID stocke la liste et les sommes de contrôle de vos fichiers dans le fichier de contenu. diff --git a/doc/snapraid-fr.d b/doc/snapraid-fr.d index 9d2014ed..8a483567 100644 --- a/doc/snapraid-fr.d +++ b/doc/snapraid-fr.d @@ -1531,6 +1531,48 @@ Motif (Pattern) ligne de commande, vous devez les mettre entre guillemets pour empêcher le shell de les développer. +Ignorer des Fichiers (Ignore Files) + En plus des règles globales du fichier de configuration, vous pouvez + placer des fichiers `.snapraidignore` dans n'importe quel répertoire de la grappe + pour définir des règles d'exclusion décentralisées. + + Les règles définies dans `.snapraidignore` sont appliquées après les règles du + fichier de configuration. Cela signifie qu'elles ont une priorité plus élevée et peuvent + être utilisées pour exclure des fichiers qui étaient précédemment inclus par la + configuration globale. En pratique, si une règle locale correspond, le fichier est + exclu quels que soient les paramètres d'inclusion globaux. + + La logique des motifs dans `.snapraidignore` reflète la configuration globale + mais ancre les motifs au répertoire où se trouve le fichier : + + =FILE + Sélectionne n'importe quel fichier nommé FILE dans ce répertoire ou en dessous. + Cela suit les mêmes règles de globbing que le motif global. + + =DIR/ + Sélectionne n'importe quel répertoire nommé DIR et tout son contenu, + résidant dans ce répertoire ou en dessous. + + =/PATH/FILE + Sélectionne le fichier exact spécifié par rapport à l'emplacement + du fichier `.snapraidignore`. + + =/PATH/DIR/ + Sélectionne le répertoire exact spécifié et tout son contenu, + par rapport à l'emplacement du fichier `.snapraidignore`. + + Contrairement à la configuration globale, les fichiers `.snapraidignore` ne prennent + en charge que les règles d'exclusion ; vous ne pouvez pas utiliser de motifs `include` ou de négation (!). + + Par exemple, si vous avez un `.snapraidignore` dans `/mnt/disk1/projects/` : + + :# Exclut UNIQUEMENT /mnt/disk1/projects/output.bin + :/output.bin + :# Exclut tout répertoire nommé 'build' dans projects/ + :build/ + :# Exclut tout fichier .tmp dans projects/ ou ses sous-dossiers + :*.tmp + Contenu (Content) SnapRAID stocke la liste et les sommes de contrôle de vos fichiers dans le fichier de contenu. diff --git a/doc/snapraid-fr.txt b/doc/snapraid-fr.txt index 516d5fd2..e72602f0 100644 --- a/doc/snapraid-fr.txt +++ b/doc/snapraid-fr.txt @@ -1631,8 +1631,53 @@ ligne de commande, vous devez les mettre entre guillemets pour empêcher le shell de les développer. -9 CONTENU (CONTENT) -=================== +9 IGNORER DES FICHIERS (IGNORE FILES) +===================================== + +En plus des règles globales du fichier de configuration, vous pouvez +placer des fichiers `.snapraidignore` dans n'importe quel répertoire de la grappe +pour définir des règles d'exclusion décentralisées. + +Les règles définies dans `.snapraidignore` sont appliquées après les règles du +fichier de configuration. Cela signifie qu'elles ont une priorité plus élevée et peuvent +être utilisées pour exclure des fichiers qui étaient précédemment inclus par la +configuration globale. En pratique, si une règle locale correspond, le fichier est +exclu quels que soient les paramètres d'inclusion globaux. + +La logique des motifs dans `.snapraidignore` reflète la configuration globale +mais ancre les motifs au répertoire où se trouve le fichier : + + FILE + Sélectionne n'importe quel fichier nommé FILE dans ce répertoire ou en dessous. + Cela suit les mêmes règles de globbing que le motif global. + + DIR/ + Sélectionne n'importe quel répertoire nommé DIR et tout son contenu, + résidant dans ce répertoire ou en dessous. + + /PATH/FILE + Sélectionne le fichier exact spécifié par rapport à l'emplacement + du fichier `.snapraidignore`. + + /PATH/DIR/ + Sélectionne le répertoire exact spécifié et tout son contenu, + par rapport à l'emplacement du fichier `.snapraidignore`. + +Contrairement à la configuration globale, les fichiers `.snapraidignore` ne prennent +en charge que les règles d'exclusion ; vous ne pouvez pas utiliser de motifs `include` ou de négation (!). + +Par exemple, si vous avez un `.snapraidignore` dans `/mnt/disk1/projects/` : + + # Exclut UNIQUEMENT /mnt/disk1/projects/output.bin + /output.bin + # Exclut tout répertoire nommé 'build' dans projects/ + build/ + # Exclut tout fichier .tmp dans projects/ ou ses sous-dossiers + *.tmp + + +10 CONTENU (CONTENT) +==================== SnapRAID stocke la liste et les sommes de contrôle de vos fichiers dans le fichier de contenu. @@ -1645,7 +1690,7 @@ Ce fichier est lu et écrit par les commandes `sync` et `scrub` et lu par les commandes `fix`, `check` et `status`. -10 PARITé (PARITY) +11 PARITé (PARITY) ================== SnapRAID stocke les informations de parité de votre baie dans @@ -1658,7 +1703,7 @@ Ces fichiers sont lus et écrits par les commandes `sync` et `fix` et lus uniquement par les commandes `scrub` et `check`. -11 ENCODAGE +12 ENCODAGE =========== SnapRAID sous Unix ignore tout encodage. Il lit et stocke les @@ -1677,13 +1722,13 @@ redirigez la sortie de la console vers un fichier, le fichier résultant est toujours au format UTF-8. -12 DROITS D'AUTEUR (COPYRIGHT) +13 DROITS D'AUTEUR (COPYRIGHT) ============================== Ce fichier est Copyright (C) 2025 Andrea Mazzoleni -13 VOIR AUSSI (SEE ALSO) +14 VOIR AUSSI (SEE ALSO) ======================== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-it.1 b/doc/snapraid-it.1 index 2ef64d5b..2afe460e 100644 --- a/doc/snapraid-it.1 +++ b/doc/snapraid-it.1 @@ -1957,6 +1957,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP In Unix, quando si utilizzano caratteri di globbing sulla riga di comando, è necessario citarli per impedire alla shell di espanderli. +.SH IGNORE FILE +In aggiunta alle regole globali nel file di configurazione, è possibile +inserire file \`.snapraidignore\` in qualsiasi directory all\'interno dell\'array +per definire regole di esclusione decentralizzate. +.PP +Le regole definite in \`.snapraidignore\` vengono applicate dopo le regole nel +file di configurazione. Ciò significa che hanno una priorità più alta e possono +essere utilizzate per escludere file che erano stati precedentemente inclusi dalla +configurazione globale. In pratica, se una regola locale corrisponde, il file viene +escluso indipendentemente dalle impostazioni di inclusione globali. +.PP +La logica dei pattern in \`.snapraidignore\` rispecchia la configurazione globale +ma ancora i pattern alla directory in cui si trova il file: +.TP +.B FILE +Seleziona qualsiasi file chiamato FILE in questa directory o sotto di essa. +Segue le stesse regole di globbing del pattern globale. +.TP +.B DIR/ +Seleziona qualsiasi directory chiamata DIR e tutto ciò che contiene, +che risieda in questa directory o sotto di essa. +.TP +.B /PATH/FILE +Seleziona l\'esatto file specificato relativo alla posizione +del file \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Seleziona l\'esatta directory specificata e tutto ciò che contiene, +relativa alla posizione del file \`.snapraidignore\`. +.PP +A differenza della configurazione globale, i file \`.snapraidignore\` supportano +solo regole di esclusione; non è possibile utilizzare pattern \`include\` o negazioni (!). +.PP +Ad esempio, se hai un \`.snapraidignore\` in \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Esclude SOLO /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Esclude qualsiasi directory chiamata \'build\' all\'interno di projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Esclude qualsiasi file .tmp all\'interno di projects/ o delle sue sottocartelle +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID memorizza l\'elenco e i checksum dei file nel file di contenuto. .PP diff --git a/doc/snapraid-it.d b/doc/snapraid-it.d index 784fb79d..67d9d395 100644 --- a/doc/snapraid-it.d +++ b/doc/snapraid-it.d @@ -1504,6 +1504,48 @@ Pattern In Unix, quando si utilizzano caratteri di globbing sulla riga di comando, è necessario citarli per impedire alla shell di espanderli. +Ignore File + In aggiunta alle regole globali nel file di configurazione, è possibile + inserire file `.snapraidignore` in qualsiasi directory all'interno dell'array + per definire regole di esclusione decentralizzate. + + Le regole definite in `.snapraidignore` vengono applicate dopo le regole nel + file di configurazione. Ciò significa che hanno una priorità più alta e possono + essere utilizzate per escludere file che erano stati precedentemente inclusi dalla + configurazione globale. In pratica, se una regola locale corrisponde, il file viene + escluso indipendentemente dalle impostazioni di inclusione globali. + + La logica dei pattern in `.snapraidignore` rispecchia la configurazione globale + ma ancora i pattern alla directory in cui si trova il file: + + =FILE + Seleziona qualsiasi file chiamato FILE in questa directory o sotto di essa. + Segue le stesse regole di globbing del pattern globale. + + =DIR/ + Seleziona qualsiasi directory chiamata DIR e tutto ciò che contiene, + che risieda in questa directory o sotto di essa. + + =/PATH/FILE + Seleziona l'esatto file specificato relativo alla posizione + del file `.snapraidignore`. + + =/PATH/DIR/ + Seleziona l'esatta directory specificata e tutto ciò che contiene, + relativa alla posizione del file `.snapraidignore`. + + A differenza della configurazione globale, i file `.snapraidignore` supportano + solo regole di esclusione; non è possibile utilizzare pattern `include` o negazioni (!). + + Ad esempio, se hai un `.snapraidignore` in `/mnt/disk1/projects/`: + + :# Esclude SOLO /mnt/disk1/projects/output.bin + :/output.bin + :# Esclude qualsiasi directory chiamata 'build' all'interno di projects/ + :build/ + :# Esclude qualsiasi file .tmp all'interno di projects/ o delle sue sottocartelle + :*.tmp + Content SnapRAID memorizza l'elenco e i checksum dei file nel file di contenuto. diff --git a/doc/snapraid-it.txt b/doc/snapraid-it.txt index 39309ba0..5eca0adf 100644 --- a/doc/snapraid-it.txt +++ b/doc/snapraid-it.txt @@ -1604,8 +1604,53 @@ In Unix, quando si utilizzano caratteri di globbing sulla riga di comando, è necessario citarli per impedire alla shell di espanderli. -9 CONTENT -========= +9 IGNORE FILE +============= + +In aggiunta alle regole globali nel file di configurazione, è possibile +inserire file `.snapraidignore` in qualsiasi directory all'interno dell'array +per definire regole di esclusione decentralizzate. + +Le regole definite in `.snapraidignore` vengono applicate dopo le regole nel +file di configurazione. Ciò significa che hanno una priorità più alta e possono +essere utilizzate per escludere file che erano stati precedentemente inclusi dalla +configurazione globale. In pratica, se una regola locale corrisponde, il file viene +escluso indipendentemente dalle impostazioni di inclusione globali. + +La logica dei pattern in `.snapraidignore` rispecchia la configurazione globale +ma ancora i pattern alla directory in cui si trova il file: + + FILE + Seleziona qualsiasi file chiamato FILE in questa directory o sotto di essa. + Segue le stesse regole di globbing del pattern globale. + + DIR/ + Seleziona qualsiasi directory chiamata DIR e tutto ciò che contiene, + che risieda in questa directory o sotto di essa. + + /PATH/FILE + Seleziona l'esatto file specificato relativo alla posizione + del file `.snapraidignore`. + + /PATH/DIR/ + Seleziona l'esatta directory specificata e tutto ciò che contiene, + relativa alla posizione del file `.snapraidignore`. + +A differenza della configurazione globale, i file `.snapraidignore` supportano +solo regole di esclusione; non è possibile utilizzare pattern `include` o negazioni (!). + +Ad esempio, se hai un `.snapraidignore` in `/mnt/disk1/projects/`: + + # Esclude SOLO /mnt/disk1/projects/output.bin + /output.bin + # Esclude qualsiasi directory chiamata 'build' all'interno di projects/ + build/ + # Esclude qualsiasi file .tmp all'interno di projects/ o delle sue sottocartelle + *.tmp + + +10 CONTENT +========== SnapRAID memorizza l'elenco e i checksum dei file nel file di contenuto. @@ -1616,7 +1661,7 @@ Questo file viene letto e scritto dai comandi `sync` e `scrub` e letto dai comandi `fix`, `check` e `status`. -10 PARITY +11 PARITY ========= SnapRAID memorizza le informazioni di parità dell'array nei file di @@ -1629,7 +1674,7 @@ Questi file vengono letti e scritti dai comandi `sync` e `fix` e solo letti dai comandi `scrub` e `check`. -11 CODIFICA +12 CODIFICA =========== SnapRAID in Unix ignora qualsiasi codifica. Legge e memorizza i @@ -1647,13 +1692,13 @@ reindirizza l'output della console a un file, il file risultante è sempre in formato UTF-8. -12 COPYRIGHT +13 COPYRIGHT ============ Questo file è Copyright (C) 2025 Andrea Mazzoleni -13 VEDI ANCHE +14 VEDI ANCHE ============= snapraid_log(1), rsync(1) diff --git a/doc/snapraid-ja.1 b/doc/snapraid-ja.1 index 5fa72420..76efcba6 100644 --- a/doc/snapraid-ja.1 +++ b/doc/snapraid-ja.1 @@ -1748,6 +1748,65 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP Unixでは、コマンドラインでグロブ文字を使用する場合、シェルがそれらを展開するのを 防ぐために引用符で囲む必要があります。 +.SH IGNORE FILE +設定ファイルのグローバルルールに加えて、アレイ内の任意のディレクトリに +.snapraidignore ファイルを配置して、分散型の除外ルールを定義できます。 +.PP +\`.snapraidignore\` で定義されたルールは、設定ファイルのルールの後に +適用されます。これは、それらがより高い優先度を持ち、グローバル設定で +以前に含まれていたファイルを除外するために使用できることを意味します。 +事実上、ローカルルールが一致する場合、グローバルな包含設定に関係なく、 +ファイルは除外されます。 +.PP +\`.snapraidignore\` のパターンロジックはグローバル設定を反映していますが、 +パターンはそのファイルが配置されているディレクトリに固定されます: +.TP +.B FILE +このディレクトリまたはその下にある、FILE という名前の任意のファイルを +選択します。これは、グローバルパターンと同じグロッビングルールに従います。 +.TP +.B DIR/ +このディレクトリまたはその下にある、DIR という名前の任意のディレクトリと +その中のすべてを選択します。 +.TP +.B /PATH/FILE +\`.snapraidignore\` ファイルの場所を基準にして、指定された正確な +ファイルを選択します。 +.TP +.B /PATH/DIR/ +\`.snapraidignore\` ファイルの場所を基準にして、指定された正確な +ディレクトリとその中のすべてを選択します。 +.PP +グローバル設定とは異なり、\`.snapraidignore\` ファイルは除外ルールのみを +サポートします。\`include\` パターンや否定 (!) は使用できません。 +.PP +たとえば、\`/mnt/disk1/projects/\` に \`.snapraidignore\` がある場合: +.PP +.RS 4 +# /mnt/disk1/projects/output.bin のみを除外 +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# projects/ 内の \'build\' という名前のディレクトリをすべて除外 +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# projects/ またはそのサブフォルダ内のすべての .tmp ファイルを除外 +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAIDは、ファイルの一覧とチェックサムをコンテンツファイルに保存します。 .PP diff --git a/doc/snapraid-ja.d b/doc/snapraid-ja.d index 368f9c52..8cc34f13 100644 --- a/doc/snapraid-ja.d +++ b/doc/snapraid-ja.d @@ -1309,6 +1309,47 @@ Pattern Unixでは、コマンドラインでグロブ文字を使用する場合、シェルがそれらを展開するのを 防ぐために引用符で囲む必要があります。 +Ignore File + 設定ファイルのグローバルルールに加えて、アレイ内の任意のディレクトリに + .snapraidignore ファイルを配置して、分散型の除外ルールを定義できます。 + + `.snapraidignore` で定義されたルールは、設定ファイルのルールの後に + 適用されます。これは、それらがより高い優先度を持ち、グローバル設定で + 以前に含まれていたファイルを除外するために使用できることを意味します。 + 事実上、ローカルルールが一致する場合、グローバルな包含設定に関係なく、 + ファイルは除外されます。 + + `.snapraidignore` のパターンロジックはグローバル設定を反映していますが、 + パターンはそのファイルが配置されているディレクトリに固定されます: + + =FILE + このディレクトリまたはその下にある、FILE という名前の任意のファイルを + 選択します。これは、グローバルパターンと同じグロッビングルールに従います。 + + =DIR/ + このディレクトリまたはその下にある、DIR という名前の任意のディレクトリと + その中のすべてを選択します。 + + =/PATH/FILE + `.snapraidignore` ファイルの場所を基準にして、指定された正確な + ファイルを選択します。 + + =/PATH/DIR/ + `.snapraidignore` ファイルの場所を基準にして、指定された正確な + ディレクトリとその中のすべてを選択します。 + + グローバル設定とは異なり、`.snapraidignore` ファイルは除外ルールのみを + サポートします。`include` パターンや否定 (!) は使用できません。 + + たとえば、`/mnt/disk1/projects/` に `.snapraidignore` がある場合: + + :# /mnt/disk1/projects/output.bin のみを除外 + :/output.bin + :# projects/ 内の 'build' という名前のディレクトリをすべて除外 + :build/ + :# projects/ またはそのサブフォルダ内のすべての .tmp ファイルを除外 + :*.tmp + Content SnapRAIDは、ファイルの一覧とチェックサムをコンテンツファイルに保存します。 diff --git a/doc/snapraid-ja.txt b/doc/snapraid-ja.txt index 08a7f97f..8a1fa744 100644 --- a/doc/snapraid-ja.txt +++ b/doc/snapraid-ja.txt @@ -1409,8 +1409,52 @@ Unixでは、コマンドラインでグロブ文字を使用する場合、シ 防ぐために引用符で囲む必要があります。 -9 CONTENT -========= +9 IGNORE FILE +============= + +設定ファイルのグローバルルールに加えて、アレイ内の任意のディレクトリに +.snapraidignore ファイルを配置して、分散型の除外ルールを定義できます。 + +`.snapraidignore` で定義されたルールは、設定ファイルのルールの後に +適用されます。これは、それらがより高い優先度を持ち、グローバル設定で +以前に含まれていたファイルを除外するために使用できることを意味します。 +事実上、ローカルルールが一致する場合、グローバルな包含設定に関係なく、 +ファイルは除外されます。 + +`.snapraidignore` のパターンロジックはグローバル設定を反映していますが、 +パターンはそのファイルが配置されているディレクトリに固定されます: + + FILE + このディレクトリまたはその下にある、FILE という名前の任意のファイルを + 選択します。これは、グローバルパターンと同じグロッビングルールに従います。 + + DIR/ + このディレクトリまたはその下にある、DIR という名前の任意のディレクトリと + その中のすべてを選択します。 + + /PATH/FILE + `.snapraidignore` ファイルの場所を基準にして、指定された正確な + ファイルを選択します。 + + /PATH/DIR/ + `.snapraidignore` ファイルの場所を基準にして、指定された正確な + ディレクトリとその中のすべてを選択します。 + +グローバル設定とは異なり、`.snapraidignore` ファイルは除外ルールのみを +サポートします。`include` パターンや否定 (!) は使用できません。 + +たとえば、`/mnt/disk1/projects/` に `.snapraidignore` がある場合: + + # /mnt/disk1/projects/output.bin のみを除外 + /output.bin + # projects/ 内の 'build' という名前のディレクトリをすべて除外 + build/ + # projects/ またはそのサブフォルダ内のすべての .tmp ファイルを除外 + *.tmp + + +10 CONTENT +========== SnapRAIDは、ファイルの一覧とチェックサムをコンテンツファイルに保存します。 @@ -1421,7 +1465,7 @@ SnapRAIDは、ファイルの一覧とチェックサムをコンテンツファ `fix`、`check`、および `status` コマンドによって読み取られます。 -10 PARITY +11 PARITY ========= SnapRAIDは、アレイのパリティ情報をパリティファイルに保存します。 @@ -1433,7 +1477,7 @@ SnapRAIDは、アレイのパリティ情報をパリティファイルに保存 `scrub` および `check` コマンドによって**読み取られるだけ**です。 -11 ENCODING +12 ENCODING =========== UnixのSnapRAIDは、エンコーディングを無視します。ファイルシステムで使用されている @@ -1448,13 +1492,13 @@ Windowsでは、ファイルシステムから読み取られたすべての名 結果のファイルは常にUTF-8形式になります。 -12 COPYRIGHT +13 COPYRIGHT ============ This file is Copyright (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-ko.1 b/doc/snapraid-ko.1 index 251b7b28..9ddfcfe1 100644 --- a/doc/snapraid-ko.1 +++ b/doc/snapraid-ko.1 @@ -1801,6 +1801,64 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP Unix에서는 명령줄에서 글로빙 문자를 사용할 때 셸이 확장하는 것을 방지하기 위해 따옴표로 묶어야 합니다. +.SH IGNORE FILE +설정 파일의 전역 규칙 외에도, 배열 내의 모든 디렉토리에 \`.snapraidignore\` +파일을 배치하여 분산된 제외 규칙을 정의할 수 있습니다. +.PP +\`.snapraidignore\`에 정의된 규칙은 설정 파일의 규칙 다음에 적용됩니다. +이는 해당 규칙들이 더 높은 우선순위를 가지며, 전역 설정에 의해 이전에 +포함되었던 파일들을 제외하는 데 사용될 수 있음을 의미합니다. 사실상 +로컬 규칙이 일치하면, 전역 포함 설정과 관계없이 해당 파일은 제외됩니다. +.PP +\`.snapraidignore\`의 패턴 로직은 전역 설정을 따르지만, 패턴은 해당 파일이 +위치한 디렉토리를 기준으로 고정됩니다: +.TP +.B FILE +이 디렉토리 또는 그 하위에서 FILE이라는 이름의 모든 파일을 선택합니다. +이는 전역 패턴과 동일한 글로빙(globbing) 규칙을 따릅니다. +.TP +.B DIR/ +이 디렉토리 또는 그 하위에서 DIR이라는 이름의 모든 디렉토리와 +그 안의 모든 항목을 선택합니다. +.TP +.B /PATH/FILE +\`.snapraidignore\` 파일의 위치를 기준으로 지정된 정확한 파일을 +선택합니다. +.TP +.B /PATH/DIR/ +\`.snapraidignore\` 파일의 위치를 기준으로 지정된 정확한 디렉토리와 +그 안의 모든 항목을 선택합니다. +.PP +전역 설정과 달리, \`.snapraidignore\` 파일은 제외 규칙만 지원합니다. +\`include\` 패턴이나 부정(!)은 사용할 수 없습니다. +.PP +예를 들어, \`/mnt/disk1/projects/\`에 \`.snapraidignore\`가 있는 경우: +.PP +.RS 4 +# /mnt/disk1/projects/output.bin만 제외 +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# projects/ 내부의 \'build\'라는 이름의 모든 디렉토리 제외 +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# projects/ 또는 그 하위 폴더의 모든 .tmp 파일 제외 +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID는 content 파일에 파일 목록과 체크섬을 저장합니다. .PP diff --git a/doc/snapraid-ko.d b/doc/snapraid-ko.d index cc20ad89..588f56db 100644 --- a/doc/snapraid-ko.d +++ b/doc/snapraid-ko.d @@ -1362,6 +1362,46 @@ Pattern Unix에서는 명령줄에서 글로빙 문자를 사용할 때 셸이 확장하는 것을 방지하기 위해 따옴표로 묶어야 합니다. +Ignore File + 설정 파일의 전역 규칙 외에도, 배열 내의 모든 디렉토리에 `.snapraidignore` + 파일을 배치하여 분산된 제외 규칙을 정의할 수 있습니다. + + `.snapraidignore`에 정의된 규칙은 설정 파일의 규칙 다음에 적용됩니다. + 이는 해당 규칙들이 더 높은 우선순위를 가지며, 전역 설정에 의해 이전에 + 포함되었던 파일들을 제외하는 데 사용될 수 있음을 의미합니다. 사실상 + 로컬 규칙이 일치하면, 전역 포함 설정과 관계없이 해당 파일은 제외됩니다. + + `.snapraidignore`의 패턴 로직은 전역 설정을 따르지만, 패턴은 해당 파일이 + 위치한 디렉토리를 기준으로 고정됩니다: + + =FILE + 이 디렉토리 또는 그 하위에서 FILE이라는 이름의 모든 파일을 선택합니다. + 이는 전역 패턴과 동일한 글로빙(globbing) 규칙을 따릅니다. + + =DIR/ + 이 디렉토리 또는 그 하위에서 DIR이라는 이름의 모든 디렉토리와 + 그 안의 모든 항목을 선택합니다. + + =/PATH/FILE + `.snapraidignore` 파일의 위치를 기준으로 지정된 정확한 파일을 + 선택합니다. + + =/PATH/DIR/ + `.snapraidignore` 파일의 위치를 기준으로 지정된 정확한 디렉토리와 + 그 안의 모든 항목을 선택합니다. + + 전역 설정과 달리, `.snapraidignore` 파일은 제외 규칙만 지원합니다. + `include` 패턴이나 부정(!)은 사용할 수 없습니다. + + 예를 들어, `/mnt/disk1/projects/`에 `.snapraidignore`가 있는 경우: + + :# /mnt/disk1/projects/output.bin만 제외 + :/output.bin + :# projects/ 내부의 'build'라는 이름의 모든 디렉토리 제외 + :build/ + :# projects/ 또는 그 하위 폴더의 모든 .tmp 파일 제외 + :*.tmp + Content SnapRAID는 content 파일에 파일 목록과 체크섬을 저장합니다. diff --git a/doc/snapraid-ko.txt b/doc/snapraid-ko.txt index 0c3b10ad..3d230371 100644 --- a/doc/snapraid-ko.txt +++ b/doc/snapraid-ko.txt @@ -1462,8 +1462,51 @@ Unix에서는 명령줄에서 글로빙 문자를 사용할 때 셸이 확장하 방지하기 위해 따옴표로 묶어야 합니다. -9 CONTENT -========= +9 IGNORE FILE +============= + +설정 파일의 전역 규칙 외에도, 배열 내의 모든 디렉토리에 `.snapraidignore` +파일을 배치하여 분산된 제외 규칙을 정의할 수 있습니다. + +`.snapraidignore`에 정의된 규칙은 설정 파일의 규칙 다음에 적용됩니다. +이는 해당 규칙들이 더 높은 우선순위를 가지며, 전역 설정에 의해 이전에 +포함되었던 파일들을 제외하는 데 사용될 수 있음을 의미합니다. 사실상 +로컬 규칙이 일치하면, 전역 포함 설정과 관계없이 해당 파일은 제외됩니다. + +`.snapraidignore`의 패턴 로직은 전역 설정을 따르지만, 패턴은 해당 파일이 +위치한 디렉토리를 기준으로 고정됩니다: + + FILE + 이 디렉토리 또는 그 하위에서 FILE이라는 이름의 모든 파일을 선택합니다. + 이는 전역 패턴과 동일한 글로빙(globbing) 규칙을 따릅니다. + + DIR/ + 이 디렉토리 또는 그 하위에서 DIR이라는 이름의 모든 디렉토리와 + 그 안의 모든 항목을 선택합니다. + + /PATH/FILE + `.snapraidignore` 파일의 위치를 기준으로 지정된 정확한 파일을 + 선택합니다. + + /PATH/DIR/ + `.snapraidignore` 파일의 위치를 기준으로 지정된 정확한 디렉토리와 + 그 안의 모든 항목을 선택합니다. + +전역 설정과 달리, `.snapraidignore` 파일은 제외 규칙만 지원합니다. +`include` 패턴이나 부정(!)은 사용할 수 없습니다. + +예를 들어, `/mnt/disk1/projects/`에 `.snapraidignore`가 있는 경우: + + # /mnt/disk1/projects/output.bin만 제외 + /output.bin + # projects/ 내부의 'build'라는 이름의 모든 디렉토리 제외 + build/ + # projects/ 또는 그 하위 폴더의 모든 .tmp 파일 제외 + *.tmp + + +10 CONTENT +========== SnapRAID는 content 파일에 파일 목록과 체크섬을 저장합니다. @@ -1474,7 +1517,7 @@ SnapRAID는 content 파일에 파일 목록과 체크섬을 저장합니다. `fix`, `check`, 및 `status` 명령에 의해 읽혀집니다. -10 PARITY +11 PARITY ========= SnapRAID는 패리티 파일에 어레이의 패리티 정보를 저장합니다. @@ -1486,7 +1529,7 @@ SnapRAID는 패리티 파일에 어레이의 패리티 정보를 저장합니다 `scrub` 및 `check` 명령에 의해서만 읽혀집니다. -11 ENCODING +12 ENCODING =========== Unix의 SnapRAID는 인코딩을 무시합니다. 파일 시스템에서 사용되는 @@ -1502,13 +1545,13 @@ Windows 콘솔을 UTF-8 모드로 설정하고 콘솔 글꼴로 `Lucida Console` 리디렉션하는 경우 결과 파일은 항상 UTF-8 형식입니다. -12 COPYRIGHT +13 COPYRIGHT ============ This file is Copyright (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-pl.1 b/doc/snapraid-pl.1 index 915c0a4f..88c460f4 100644 --- a/doc/snapraid-pl.1 +++ b/doc/snapraid-pl.1 @@ -1843,6 +1843,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP W systemie Unix, używając znaków globbing w wierszu poleceń, musisz je cytować, aby zapobiec ich rozszerzeniu przez powłokę. +.SH IGNORE FILE +Oprócz reguł globalnych w pliku konfiguracyjnym, możesz umieścić pliki +\`.snapraidignore\` w dowolnym katalogu w macierzy, aby zdefiniować +zdecentralizowane reguły wykluczania. +.PP +Reguły zdefiniowane w \`.snapraidignore\` są stosowane po regułach w pliku +konfiguracyjnym. Oznacza to, że mają one wyższy priorytet i mogą być używane +do wykluczania plików, które zostały wcześniej uwzględnione przez konfigurację +globalną. Skutecznie, jeśli reguła lokalna pasuje, plik jest wykluczany bez +względu na globalne ustawienia uwzględniania. +.PP +Logika wzorców w \`.snapraidignore\` odzwierciedla konfigurację globalną, ale +zakotwicza wzorce w katalogu, w którym znajduje się plik: +.TP +.B FILE +Wybiera dowolny plik o nazwie FILE w tym katalogu lub poniżej. +Podlega to tym samym zasadom dopasowywania (globbing) co wzorzec globalny. +.TP +.B DIR/ +Wybiera dowolny katalog o nazwie DIR i wszystko w jego wnętrzu, +znajdujący się w tym katalogu lub poniżej. +.TP +.B /PATH/FILE +Wybiera dokładnie określony plik względem lokalizacji +pliku \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Wybiera dokładnie określony katalog i wszystko w jego wnętrzu, +względem lokalizacji pliku \`.snapraidignore\`. +.PP +W przeciwieństwie do konfiguracji globalnej, pliki \`.snapraidignore\` obsługują +tylko reguły wykluczania; nie można używać wzorców \`include\` ani negacji (!). +.PP +Na przykład, jeśli masz \`.snapraidignore\` w \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Wyklucza TYLKO /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Wyklucza każdy katalog o nazwie \'build\' wewnątrz projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Wyklucza każdy plik .tmp wewnątrz projects/ lub jego podfolderach +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID przechowuje listę i sumy kontrolne Twoich plików w pliku zawartości. .PP diff --git a/doc/snapraid-pl.d b/doc/snapraid-pl.d index d0067be0..5c4c315d 100644 --- a/doc/snapraid-pl.d +++ b/doc/snapraid-pl.d @@ -1404,6 +1404,48 @@ Pattern W systemie Unix, używając znaków globbing w wierszu poleceń, musisz je cytować, aby zapobiec ich rozszerzeniu przez powłokę. +Ignore File + Oprócz reguł globalnych w pliku konfiguracyjnym, możesz umieścić pliki + `.snapraidignore` w dowolnym katalogu w macierzy, aby zdefiniować + zdecentralizowane reguły wykluczania. + + Reguły zdefiniowane w `.snapraidignore` są stosowane po regułach w pliku + konfiguracyjnym. Oznacza to, że mają one wyższy priorytet i mogą być używane + do wykluczania plików, które zostały wcześniej uwzględnione przez konfigurację + globalną. Skutecznie, jeśli reguła lokalna pasuje, plik jest wykluczany bez + względu na globalne ustawienia uwzględniania. + + Logika wzorców w `.snapraidignore` odzwierciedla konfigurację globalną, ale + zakotwicza wzorce w katalogu, w którym znajduje się plik: + + =FILE + Wybiera dowolny plik o nazwie FILE w tym katalogu lub poniżej. + Podlega to tym samym zasadom dopasowywania (globbing) co wzorzec globalny. + + =DIR/ + Wybiera dowolny katalog o nazwie DIR i wszystko w jego wnętrzu, + znajdujący się w tym katalogu lub poniżej. + + =/PATH/FILE + Wybiera dokładnie określony plik względem lokalizacji + pliku `.snapraidignore`. + + =/PATH/DIR/ + Wybiera dokładnie określony katalog i wszystko w jego wnętrzu, + względem lokalizacji pliku `.snapraidignore`. + + W przeciwieństwie do konfiguracji globalnej, pliki `.snapraidignore` obsługują + tylko reguły wykluczania; nie można używać wzorców `include` ani negacji (!). + + Na przykład, jeśli masz `.snapraidignore` w `/mnt/disk1/projects/`: + + :# Wyklucza TYLKO /mnt/disk1/projects/output.bin + :/output.bin + :# Wyklucza każdy katalog o nazwie 'build' wewnątrz projects/ + :build/ + :# Wyklucza każdy plik .tmp wewnątrz projects/ lub jego podfolderach + :*.tmp + Content SnapRAID przechowuje listę i sumy kontrolne Twoich plików w pliku zawartości. diff --git a/doc/snapraid-pl.txt b/doc/snapraid-pl.txt index cff8efd9..12ad77da 100644 --- a/doc/snapraid-pl.txt +++ b/doc/snapraid-pl.txt @@ -1504,8 +1504,53 @@ W systemie Unix, używając znaków globbing w wierszu poleceń, musisz je cytować, aby zapobiec ich rozszerzeniu przez powłokę. -9 CONTENT -========= +9 IGNORE FILE +============= + +Oprócz reguł globalnych w pliku konfiguracyjnym, możesz umieścić pliki +`.snapraidignore` w dowolnym katalogu w macierzy, aby zdefiniować +zdecentralizowane reguły wykluczania. + +Reguły zdefiniowane w `.snapraidignore` są stosowane po regułach w pliku +konfiguracyjnym. Oznacza to, że mają one wyższy priorytet i mogą być używane +do wykluczania plików, które zostały wcześniej uwzględnione przez konfigurację +globalną. Skutecznie, jeśli reguła lokalna pasuje, plik jest wykluczany bez +względu na globalne ustawienia uwzględniania. + +Logika wzorców w `.snapraidignore` odzwierciedla konfigurację globalną, ale +zakotwicza wzorce w katalogu, w którym znajduje się plik: + + FILE + Wybiera dowolny plik o nazwie FILE w tym katalogu lub poniżej. + Podlega to tym samym zasadom dopasowywania (globbing) co wzorzec globalny. + + DIR/ + Wybiera dowolny katalog o nazwie DIR i wszystko w jego wnętrzu, + znajdujący się w tym katalogu lub poniżej. + + /PATH/FILE + Wybiera dokładnie określony plik względem lokalizacji + pliku `.snapraidignore`. + + /PATH/DIR/ + Wybiera dokładnie określony katalog i wszystko w jego wnętrzu, + względem lokalizacji pliku `.snapraidignore`. + +W przeciwieństwie do konfiguracji globalnej, pliki `.snapraidignore` obsługują +tylko reguły wykluczania; nie można używać wzorców `include` ani negacji (!). + +Na przykład, jeśli masz `.snapraidignore` w `/mnt/disk1/projects/`: + + # Wyklucza TYLKO /mnt/disk1/projects/output.bin + /output.bin + # Wyklucza każdy katalog o nazwie 'build' wewnątrz projects/ + build/ + # Wyklucza każdy plik .tmp wewnątrz projects/ lub jego podfolderach + *.tmp + + +10 CONTENT +========== SnapRAID przechowuje listę i sumy kontrolne Twoich plików w pliku zawartości. @@ -1516,7 +1561,7 @@ Ten plik jest odczytywany i zapisywany przez polecenia `sync` i `scrub` oraz odczytywany przez polecenia `fix`, `check` i `status`. -10 PARITY +11 PARITY ========= SnapRAID przechowuje informacje o parzystości Twojej macierzy w plikach @@ -1529,7 +1574,7 @@ Pliki te są odczytywane i zapisywane przez polecenia `sync` i `fix` oraz tylko odczytywane przez polecenia `scrub` i `check`. -11 ENCODING +12 ENCODING =========== SnapRAID w systemie Unix ignoruje wszelkie kodowanie. Odczytuje i przechowuje @@ -1546,13 +1591,13 @@ przekierujesz wyjście konsoli do pliku, wynikowy plik jest zawsze w formacie UTF-8. -12 COPYRIGHT +13 COPYRIGHT ============ Ten plik jest chroniony prawem autorskim (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-pt.1 b/doc/snapraid-pt.1 index 0375cb4c..862d83cb 100644 --- a/doc/snapraid-pt.1 +++ b/doc/snapraid-pt.1 @@ -1882,6 +1882,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP No Unix, ao usar caracteres globbing na linha de comando, você deve citá\-los para evitar que o shell os expanda. +.SH IGNORAR ARQUIVOS (IGNORE FILE) +Além das regras globais no arquivo de configuração, você pode colocar +arquivos \`.snapraidignore\` em qualquer diretório dentro do array para definir +regras de exclusão descentralizadas. +.PP +As regras definidas em \`.snapraidignore\` são aplicadas após as regras no +arquivo de configuração. Isso significa que elas têm uma prioridade maior e +podem ser usadas para excluir arquivos que foram anteriormente incluídos pela +configuração global. Efetivamente, se uma regra local corresponder, o arquivo +é excluído independentemente das configurações globais de inclusão. +.PP +A lógica de padrões no \`.snapraidignore\` espelha a configuração global, mas +ancora os padrões ao diretório onde o arquivo está localizado: +.TP +.B FILE +Seleciona qualquer arquivo chamado FILE neste diretório ou abaixo. +Isso segue as mesmas regras de globbing do padrão global. +.TP +.B DIR/ +Seleciona qualquer diretório chamado DIR e tudo dentro dele, +residente neste diretório ou abaixo. +.TP +.B /PATH/FILE +Seleciona o arquivo exato especificado relativo à localização +do arquivo \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Seleciona o diretório exato especificado e tudo dentro dele, +relativo à localização do arquivo \`.snapraidignore\`. +.PP +Ao contrário da configuração global, os arquivos \`.snapraidignore\` suportam +apenas regras de exclusão; você não pode usar padrões \`include\` ou negação (!). +.PP +Por exemplo, se você tiver um \`.snapraidignore\` em \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Exclui APENAS /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Exclui qualquer diretório chamado \'build\' dentro de projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Exclui qualquer arquivo .tmp dentro de projects/ ou suas subpastas +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTEúDO (CONTENT) SnapRAID armazena a lista e os checksums de seus arquivos no arquivo content. .PP diff --git a/doc/snapraid-pt.d b/doc/snapraid-pt.d index 341ac206..9dfc314f 100644 --- a/doc/snapraid-pt.d +++ b/doc/snapraid-pt.d @@ -1443,6 +1443,48 @@ Padrão (Pattern) No Unix, ao usar caracteres globbing na linha de comando, você deve citá-los para evitar que o shell os expanda. +Ignorar Arquivos (Ignore File) + Além das regras globais no arquivo de configuração, você pode colocar + arquivos `.snapraidignore` em qualquer diretório dentro do array para definir + regras de exclusão descentralizadas. + + As regras definidas em `.snapraidignore` são aplicadas após as regras no + arquivo de configuração. Isso significa que elas têm uma prioridade maior e + podem ser usadas para excluir arquivos que foram anteriormente incluídos pela + configuração global. Efetivamente, se uma regra local corresponder, o arquivo + é excluído independentemente das configurações globais de inclusão. + + A lógica de padrões no `.snapraidignore` espelha a configuração global, mas + ancora os padrões ao diretório onde o arquivo está localizado: + + =FILE + Seleciona qualquer arquivo chamado FILE neste diretório ou abaixo. + Isso segue as mesmas regras de globbing do padrão global. + + =DIR/ + Seleciona qualquer diretório chamado DIR e tudo dentro dele, + residente neste diretório ou abaixo. + + =/PATH/FILE + Seleciona o arquivo exato especificado relativo à localização + do arquivo `.snapraidignore`. + + =/PATH/DIR/ + Seleciona o diretório exato especificado e tudo dentro dele, + relativo à localização do arquivo `.snapraidignore`. + + Ao contrário da configuração global, os arquivos `.snapraidignore` suportam + apenas regras de exclusão; você não pode usar padrões `include` ou negação (!). + + Por exemplo, se você tiver um `.snapraidignore` em `/mnt/disk1/projects/`: + + :# Exclui APENAS /mnt/disk1/projects/output.bin + :/output.bin + :# Exclui qualquer diretório chamado 'build' dentro de projects/ + :build/ + :# Exclui qualquer arquivo .tmp dentro de projects/ ou suas subpastas + :*.tmp + Conteúdo (Content) SnapRAID armazena a lista e os checksums de seus arquivos no arquivo content. diff --git a/doc/snapraid-pt.txt b/doc/snapraid-pt.txt index 6e78c801..6550f64f 100644 --- a/doc/snapraid-pt.txt +++ b/doc/snapraid-pt.txt @@ -1543,8 +1543,53 @@ No Unix, ao usar caracteres globbing na linha de comando, você deve citá-los para evitar que o shell os expanda. -9 CONTEúDO (CONTENT) -==================== +9 IGNORAR ARQUIVOS (IGNORE FILE) +================================ + +Além das regras globais no arquivo de configuração, você pode colocar +arquivos `.snapraidignore` em qualquer diretório dentro do array para definir +regras de exclusão descentralizadas. + +As regras definidas em `.snapraidignore` são aplicadas após as regras no +arquivo de configuração. Isso significa que elas têm uma prioridade maior e +podem ser usadas para excluir arquivos que foram anteriormente incluídos pela +configuração global. Efetivamente, se uma regra local corresponder, o arquivo +é excluído independentemente das configurações globais de inclusão. + +A lógica de padrões no `.snapraidignore` espelha a configuração global, mas +ancora os padrões ao diretório onde o arquivo está localizado: + + FILE + Seleciona qualquer arquivo chamado FILE neste diretório ou abaixo. + Isso segue as mesmas regras de globbing do padrão global. + + DIR/ + Seleciona qualquer diretório chamado DIR e tudo dentro dele, + residente neste diretório ou abaixo. + + /PATH/FILE + Seleciona o arquivo exato especificado relativo à localização + do arquivo `.snapraidignore`. + + /PATH/DIR/ + Seleciona o diretório exato especificado e tudo dentro dele, + relativo à localização do arquivo `.snapraidignore`. + +Ao contrário da configuração global, os arquivos `.snapraidignore` suportam +apenas regras de exclusão; você não pode usar padrões `include` ou negação (!). + +Por exemplo, se você tiver um `.snapraidignore` em `/mnt/disk1/projects/`: + + # Exclui APENAS /mnt/disk1/projects/output.bin + /output.bin + # Exclui qualquer diretório chamado 'build' dentro de projects/ + build/ + # Exclui qualquer arquivo .tmp dentro de projects/ ou suas subpastas + *.tmp + + +10 CONTEúDO (CONTENT) +===================== SnapRAID armazena a lista e os checksums de seus arquivos no arquivo content. @@ -1555,7 +1600,7 @@ Este arquivo é lido e escrito pelos comandos `sync` e `scrub` e lido pelos comandos `fix`, `check` e `status`. -10 PARIDADE (PARITY) +11 PARIDADE (PARITY) ==================== SnapRAID armazena as informações de paridade do seu array nos arquivos parity. @@ -1567,7 +1612,7 @@ Estes arquivos são lidos e escritos pelos comandos `sync` e `fix` e apenas lidos pelos comandos `scrub` e `check`. -11 CODIFICAçãO (ENCODING) +12 CODIFICAçãO (ENCODING) ========================= SnapRAID no Unix ignora qualquer codificação. Ele lê e armazena os @@ -1584,13 +1629,13 @@ redirecionar a saída do console para um arquivo, o arquivo resultante estará sempre no formato UTF-8. -12 DIREITOS AUTORAIS (COPYRIGHT) +13 DIREITOS AUTORAIS (COPYRIGHT) ================================ Este arquivo é Copyright (C) 2025 Andrea Mazzoleni -13 VEJA TAMBéM (SEE ALSO) +14 VEJA TAMBéM (SEE ALSO) ========================= snapraid_log(1), rsync(1) diff --git a/doc/snapraid-ro.1 b/doc/snapraid-ro.1 index 8d59b95d..6b02ec61 100644 --- a/doc/snapraid-ro.1 +++ b/doc/snapraid-ro.1 @@ -1845,6 +1845,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP În Unix, când utilizați caractere globbing pe linia de comandă, trebuie să le citați pentru a împiedica shell\-ul să le extindă. +.SH FIșIERE DE IGNORAT (IGNORE FILE) +Pe lângă regulile globale din fișierul de configurare, puteți plasa fișiere +\`.snapraidignore\` în orice director din array pentru a defini reguli de excludere +descentralizate. +.PP +Regulile definite în \`.snapraidignore\` sunt aplicate după regulile din fișierul +de configurare. Acest lucru înseamnă că au o prioritate mai mare și pot fi +utilizate pentru a exclude fișiere care au fost incluse anterior de configurația +globală. Efectiv, dacă o regulă locală se potrivește, fișierul este exclus +indiferent de setările globale de includere. +.PP +Logica modelelor în \`.snapraidignore\` oglindește configurația globală, dar +ancorează modelele de directorul în care se află fișierul: +.TP +.B FILE +Selectează orice fișier numit FILE în acest director sau mai jos. +Acesta urmează aceleași reguli de globbing ca modelul global. +.TP +.B DIR/ +Selectează orice director numit DIR și tot ce se află în interior, +aflat în acest director sau mai jos. +.TP +.B /PATH/FILE +Selectează fișierul exact specificat raportat la locația +fișierului \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Selectează directorul exact specificat și tot ce se află în interior, +raportat la locația fișierului \`.snapraidignore\`. +.PP +Spre deosebire de configurația globală, fișierele \`.snapraidignore\` suportă +doar reguli de excludere; nu puteți utiliza modele de \`include\` sau negația (!). +.PP +De exemplu, dacă aveți un \`.snapraidignore\` în \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Exclude DOAR /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Exclude orice director numit \'build\' în interiorul projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Exclude orice fișier .tmp în interiorul projects/ sau subfolderele sale +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONțINUT (CONTENT) SnapRAID stochează lista și sumele de control (checksums) ale fișierelor dvs. în fișierul de conținut. .PP diff --git a/doc/snapraid-ro.d b/doc/snapraid-ro.d index 110a59ab..db665eba 100644 --- a/doc/snapraid-ro.d +++ b/doc/snapraid-ro.d @@ -1406,6 +1406,48 @@ Model (Pattern) În Unix, când utilizați caractere globbing pe linia de comandă, trebuie să le citați pentru a împiedica shell-ul să le extindă. +Fișiere de Ignorat (Ignore File) + Pe lângă regulile globale din fișierul de configurare, puteți plasa fișiere + `.snapraidignore` în orice director din array pentru a defini reguli de excludere + descentralizate. + + Regulile definite în `.snapraidignore` sunt aplicate după regulile din fișierul + de configurare. Acest lucru înseamnă că au o prioritate mai mare și pot fi + utilizate pentru a exclude fișiere care au fost incluse anterior de configurația + globală. Efectiv, dacă o regulă locală se potrivește, fișierul este exclus + indiferent de setările globale de includere. + + Logica modelelor în `.snapraidignore` oglindește configurația globală, dar + ancorează modelele de directorul în care se află fișierul: + + =FILE + Selectează orice fișier numit FILE în acest director sau mai jos. + Acesta urmează aceleași reguli de globbing ca modelul global. + + =DIR/ + Selectează orice director numit DIR și tot ce se află în interior, + aflat în acest director sau mai jos. + + =/PATH/FILE + Selectează fișierul exact specificat raportat la locația + fișierului `.snapraidignore`. + + =/PATH/DIR/ + Selectează directorul exact specificat și tot ce se află în interior, + raportat la locația fișierului `.snapraidignore`. + + Spre deosebire de configurația globală, fișierele `.snapraidignore` suportă + doar reguli de excludere; nu puteți utiliza modele de `include` sau negația (!). + + De exemplu, dacă aveți un `.snapraidignore` în `/mnt/disk1/projects/`: + + :# Exclude DOAR /mnt/disk1/projects/output.bin + :/output.bin + :# Exclude orice director numit 'build' în interiorul projects/ + :build/ + :# Exclude orice fișier .tmp în interiorul projects/ sau subfolderele sale + :*.tmp + Conținut (Content) SnapRAID stochează lista și sumele de control (checksums) ale fișierelor dvs. în fișierul de conținut. diff --git a/doc/snapraid-ro.txt b/doc/snapraid-ro.txt index 8f780864..bbaaf114 100644 --- a/doc/snapraid-ro.txt +++ b/doc/snapraid-ro.txt @@ -1506,8 +1506,53 @@ De exemplu: să le citați pentru a împiedica shell-ul să le extindă. -9 CONțINUT (CONTENT) -==================== +9 FIșIERE DE IGNORAT (IGNORE FILE) +================================== + +Pe lângă regulile globale din fișierul de configurare, puteți plasa fișiere +`.snapraidignore` în orice director din array pentru a defini reguli de excludere +descentralizate. + +Regulile definite în `.snapraidignore` sunt aplicate după regulile din fișierul +de configurare. Acest lucru înseamnă că au o prioritate mai mare și pot fi +utilizate pentru a exclude fișiere care au fost incluse anterior de configurația +globală. Efectiv, dacă o regulă locală se potrivește, fișierul este exclus +indiferent de setările globale de includere. + +Logica modelelor în `.snapraidignore` oglindește configurația globală, dar +ancorează modelele de directorul în care se află fișierul: + + FILE + Selectează orice fișier numit FILE în acest director sau mai jos. + Acesta urmează aceleași reguli de globbing ca modelul global. + + DIR/ + Selectează orice director numit DIR și tot ce se află în interior, + aflat în acest director sau mai jos. + + /PATH/FILE + Selectează fișierul exact specificat raportat la locația + fișierului `.snapraidignore`. + + /PATH/DIR/ + Selectează directorul exact specificat și tot ce se află în interior, + raportat la locația fișierului `.snapraidignore`. + +Spre deosebire de configurația globală, fișierele `.snapraidignore` suportă +doar reguli de excludere; nu puteți utiliza modele de `include` sau negația (!). + +De exemplu, dacă aveți un `.snapraidignore` în `/mnt/disk1/projects/`: + + # Exclude DOAR /mnt/disk1/projects/output.bin + /output.bin + # Exclude orice director numit 'build' în interiorul projects/ + build/ + # Exclude orice fișier .tmp în interiorul projects/ sau subfolderele sale + *.tmp + + +10 CONțINUT (CONTENT) +===================== SnapRAID stochează lista și sumele de control (checksums) ale fișierelor dvs. în fișierul de conținut. @@ -1518,7 +1563,7 @@ Acest fișier este citit și scris de comenzile `sync` și `scrub` și citit de comenzile `fix`, `check` și `status`. -10 PARITATE (PARITY) +11 PARITATE (PARITY) ==================== SnapRAID stochează informațiile de paritate ale matricei dvs. în fișierele de paritate. @@ -1530,7 +1575,7 @@ Aceste fișiere sunt citite și scrise de comenzile `sync` și `fix` și doar citite de comenzile `scrub` și `check`. -11 CODARE (ENCODING) +12 CODARE (ENCODING) ==================== SnapRAID în Unix ignoră orice codare. Citește și stochează @@ -1547,13 +1592,13 @@ redirecționați ieșirea consolei către un fișier, fișierul rezultat este î în format UTF-8. -12 DREPT DE AUTOR (COPYRIGHT) +13 DREPT DE AUTOR (COPYRIGHT) ============================= Acest fișier este Copyright (C) 2025 Andrea Mazzoleni -13 VEZI șI (SEE ALSO) +14 VEZI șI (SEE ALSO) ===================== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-ru.1 b/doc/snapraid-ru.1 index c5ab2c24..1629a8cd 100644 --- a/doc/snapraid-ru.1 +++ b/doc/snapraid-ru.1 @@ -1849,6 +1849,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP В Unix при использовании символов глоббинга в командной строке вы должны заключить их в кавычки, чтобы предотвратить их расширение оболочкой. +.SH IGNORE FILE +В дополнение к глобальным правилам в файле конфигурации, вы можете +размещать файлы \`.snapraidignore\` в любом каталоге внутри массива для +определения децентрализованных правил исключения. +.PP +Правила, определенные в \`.snapraidignore\`, применяются после правил в +конфигурационном файле. Это означает, что они имеют более высокий приоритет +и могут использоваться для исключения файлов, которые ранее были включены +глобальной конфигурацией. Фактически, если локальное правило совпадает, файл +исключается независимо от глобальных настроек включения. +.PP +Логика шаблонов в \`.snapraidignore\` повторяет глобальную конфигурацию, но +привязывает шаблоны к каталогу, в котором находится файл: +.TP +.B FILE +Выбирает любой файл с именем FILE в этом каталоге или ниже. +Здесь действуют те же правила подстановки, что и в глобальном шаблоне. +.TP +.B DIR/ +Выбирает любой каталог с именем DIR и все его содержимое, +находящееся в этом каталоге или ниже. +.TP +.B /PATH/FILE +Выбирает точно указанный файл относительно местоположения +файла \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Выбирает точно указанный каталог и все его содержимое +относительно местоположения файла \`.snapraidignore\`. +.PP +В отличие от глобальной конфигурации, файлы \`.snapraidignore\` поддерживают +только правила исключения; вы не можете использовать шаблоны \`include\` или отрицание (!). +.PP +Например, если у вас есть \`.snapraidignore\` в \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Исключает ТОЛЬКО /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Исключает любой каталог с именем \'build\' внутри projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Исключает любой .tmp файл внутри projects/ или его подпапок +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID хранит список и контрольные суммы ваших файлов в файле content. .PP diff --git a/doc/snapraid-ru.d b/doc/snapraid-ru.d index 7b16ffd3..296cec30 100644 --- a/doc/snapraid-ru.d +++ b/doc/snapraid-ru.d @@ -1410,6 +1410,48 @@ Pattern В Unix при использовании символов глоббинга в командной строке вы должны заключить их в кавычки, чтобы предотвратить их расширение оболочкой. +Ignore File + В дополнение к глобальным правилам в файле конфигурации, вы можете + размещать файлы `.snapraidignore` в любом каталоге внутри массива для + определения децентрализованных правил исключения. + + Правила, определенные в `.snapraidignore`, применяются после правил в + конфигурационном файле. Это означает, что они имеют более высокий приоритет + и могут использоваться для исключения файлов, которые ранее были включены + глобальной конфигурацией. Фактически, если локальное правило совпадает, файл + исключается независимо от глобальных настроек включения. + + Логика шаблонов в `.snapraidignore` повторяет глобальную конфигурацию, но + привязывает шаблоны к каталогу, в котором находится файл: + + =FILE + Выбирает любой файл с именем FILE в этом каталоге или ниже. + Здесь действуют те же правила подстановки, что и в глобальном шаблоне. + + =DIR/ + Выбирает любой каталог с именем DIR и все его содержимое, + находящееся в этом каталоге или ниже. + + =/PATH/FILE + Выбирает точно указанный файл относительно местоположения + файла `.snapraidignore`. + + =/PATH/DIR/ + Выбирает точно указанный каталог и все его содержимое + относительно местоположения файла `.snapraidignore`. + + В отличие от глобальной конфигурации, файлы `.snapraidignore` поддерживают + только правила исключения; вы не можете использовать шаблоны `include` или отрицание (!). + + Например, если у вас есть `.snapraidignore` в `/mnt/disk1/projects/`: + + :# Исключает ТОЛЬКО /mnt/disk1/projects/output.bin + :/output.bin + :# Исключает любой каталог с именем 'build' внутри projects/ + :build/ + :# Исключает любой .tmp файл внутри projects/ или его подпапок + :*.tmp + Content SnapRAID хранит список и контрольные суммы ваших файлов в файле content. diff --git a/doc/snapraid-ru.txt b/doc/snapraid-ru.txt index 92b203c7..dc7cfa38 100644 --- a/doc/snapraid-ru.txt +++ b/doc/snapraid-ru.txt @@ -1510,8 +1510,53 @@ PARITY — это одно из имен четности: `parity`, `2-parity`, заключить их в кавычки, чтобы предотвратить их расширение оболочкой. -9 CONTENT -========= +9 IGNORE FILE +============= + +В дополнение к глобальным правилам в файле конфигурации, вы можете +размещать файлы `.snapraidignore` в любом каталоге внутри массива для +определения децентрализованных правил исключения. + +Правила, определенные в `.snapraidignore`, применяются после правил в +конфигурационном файле. Это означает, что они имеют более высокий приоритет +и могут использоваться для исключения файлов, которые ранее были включены +глобальной конфигурацией. Фактически, если локальное правило совпадает, файл +исключается независимо от глобальных настроек включения. + +Логика шаблонов в `.snapraidignore` повторяет глобальную конфигурацию, но +привязывает шаблоны к каталогу, в котором находится файл: + + FILE + Выбирает любой файл с именем FILE в этом каталоге или ниже. + Здесь действуют те же правила подстановки, что и в глобальном шаблоне. + + DIR/ + Выбирает любой каталог с именем DIR и все его содержимое, + находящееся в этом каталоге или ниже. + + /PATH/FILE + Выбирает точно указанный файл относительно местоположения + файла `.snapraidignore`. + + /PATH/DIR/ + Выбирает точно указанный каталог и все его содержимое + относительно местоположения файла `.snapraidignore`. + +В отличие от глобальной конфигурации, файлы `.snapraidignore` поддерживают +только правила исключения; вы не можете использовать шаблоны `include` или отрицание (!). + +Например, если у вас есть `.snapraidignore` в `/mnt/disk1/projects/`: + + # Исключает ТОЛЬКО /mnt/disk1/projects/output.bin + /output.bin + # Исключает любой каталог с именем 'build' внутри projects/ + build/ + # Исключает любой .tmp файл внутри projects/ или его подпапок + *.tmp + + +10 CONTENT +========== SnapRAID хранит список и контрольные суммы ваших файлов в файле content. @@ -1522,7 +1567,7 @@ SnapRAID хранит список и контрольные суммы ваши считывается командами `fix`, `check` и `status`. -10 PARITY +11 PARITY ========= SnapRAID хранит информацию четности вашего массива в файлах parity. @@ -1534,7 +1579,7 @@ SnapRAID хранит информацию четности вашего мас только считываются командами `scrub` и `check`. -11 ENCODING +12 ENCODING =========== SnapRAID в Unix игнорирует любое кодирование. Он считывает и хранит @@ -1551,13 +1596,13 @@ SnapRAID в Unix игнорирует любое кодирование. Он с в формате UTF-8. -12 COPYRIGHT +13 COPYRIGHT ============ Этот файл защищен авторским правом (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-sv.1 b/doc/snapraid-sv.1 index fcafbaa3..5a122e23 100644 --- a/doc/snapraid-sv.1 +++ b/doc/snapraid-sv.1 @@ -1850,6 +1850,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP I Unix, när du använder globbing\-tecken på kommandoraden, måste du citattecken dem för att förhindra att skalet expanderar dem. +.SH IGNORERA FILER (IGNORE FILE) +Utöver de globala reglerna i konfigurationsfilen kan du placera +\`.snapraidignore\`\-filer i vilken katalog som helst i arrayen för att definiera +decentraliserade exkluderingsregler. +.PP +Regler som definieras i \`.snapraidignore\` tillämpas efter reglerna i +konfigurationsfilen. Detta innebär att de har högre prioritet och kan +användas för att exkludera filer som tidigare inkluderats av den globala +konfigurationen. I praktiken innebär det att om en lokal regel matchar, så +exkluderas filen oavsett de globala inkluderingsinställningarna. +.PP +Mönsterlogiken i \`.snapraidignore\` speglar den globala konfigurationen men +förankrar mönstren till den katalog där filen finns: +.TP +.B FILE +Väljer alla filer med namnet FILE i denna katalog eller under. +Detta följer samma globbing\-regler som det globala mönstret. +.TP +.B DIR/ +Väljer alla kataloger med namnet DIR och allt innehåll, som finns +i denna katalog eller under. +.TP +.B /PATH/FILE +Väljer den exakt angivna filen relativt platsen för +\`.snapraidignore\`\-filen. +.TP +.B /PATH/DIR/ +Väljer den exakt angivna katalogen och allt innehåll, relativt +platsen för \`.snapraidignore\`\-filen. +.PP +Till skillnad från den globala konfigurationen stöder \`.snapraidignore\`\-filer +endast exkluderingsregler; du kan inte använda \`include\`\-mönster eller negation (!). +.PP +Till exempel, om du har en \`.snapraidignore\` i \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Exkluderar ENDAST /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Exkluderar alla kataloger med namnet \'build\' inuti projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Exkluderar alla .tmp\-filer inuti projects/ eller dess undermappar +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH INNEHåLL (CONTENT) SnapRAID lagrar listan och checksummorna för dina filer i content\-filen. .PP diff --git a/doc/snapraid-sv.d b/doc/snapraid-sv.d index e12e10fd..e061f676 100644 --- a/doc/snapraid-sv.d +++ b/doc/snapraid-sv.d @@ -1411,6 +1411,48 @@ Mönster I Unix, när du använder globbing-tecken på kommandoraden, måste du citattecken dem för att förhindra att skalet expanderar dem. +Ignorera filer (Ignore File) + Utöver de globala reglerna i konfigurationsfilen kan du placera + `.snapraidignore`-filer i vilken katalog som helst i arrayen för att definiera + decentraliserade exkluderingsregler. + + Regler som definieras i `.snapraidignore` tillämpas efter reglerna i + konfigurationsfilen. Detta innebär att de har högre prioritet och kan + användas för att exkludera filer som tidigare inkluderats av den globala + konfigurationen. I praktiken innebär det att om en lokal regel matchar, så + exkluderas filen oavsett de globala inkluderingsinställningarna. + + Mönsterlogiken i `.snapraidignore` speglar den globala konfigurationen men + förankrar mönstren till den katalog där filen finns: + + =FILE + Väljer alla filer med namnet FILE i denna katalog eller under. + Detta följer samma globbing-regler som det globala mönstret. + + =DIR/ + Väljer alla kataloger med namnet DIR och allt innehåll, som finns + i denna katalog eller under. + + =/PATH/FILE + Väljer den exakt angivna filen relativt platsen för + `.snapraidignore`-filen. + + =/PATH/DIR/ + Väljer den exakt angivna katalogen och allt innehåll, relativt + platsen för `.snapraidignore`-filen. + + Till skillnad från den globala konfigurationen stöder `.snapraidignore`-filer + endast exkluderingsregler; du kan inte använda `include`-mönster eller negation (!). + + Till exempel, om du har en `.snapraidignore` i `/mnt/disk1/projects/`: + + :# Exkluderar ENDAST /mnt/disk1/projects/output.bin + :/output.bin + :# Exkluderar alla kataloger med namnet 'build' inuti projects/ + :build/ + :# Exkluderar alla .tmp-filer inuti projects/ eller dess undermappar + :*.tmp + Innehåll (Content) SnapRAID lagrar listan och checksummorna för dina filer i content-filen. diff --git a/doc/snapraid-sv.txt b/doc/snapraid-sv.txt index 5230ecdf..23e1def1 100644 --- a/doc/snapraid-sv.txt +++ b/doc/snapraid-sv.txt @@ -1511,8 +1511,53 @@ I Unix, när du använder globbing-tecken på kommandoraden, måste du citattecken dem för att förhindra att skalet expanderar dem. -9 INNEHåLL (CONTENT) -==================== +9 IGNORERA FILER (IGNORE FILE) +============================== + +Utöver de globala reglerna i konfigurationsfilen kan du placera +`.snapraidignore`-filer i vilken katalog som helst i arrayen för att definiera +decentraliserade exkluderingsregler. + +Regler som definieras i `.snapraidignore` tillämpas efter reglerna i +konfigurationsfilen. Detta innebär att de har högre prioritet och kan +användas för att exkludera filer som tidigare inkluderats av den globala +konfigurationen. I praktiken innebär det att om en lokal regel matchar, så +exkluderas filen oavsett de globala inkluderingsinställningarna. + +Mönsterlogiken i `.snapraidignore` speglar den globala konfigurationen men +förankrar mönstren till den katalog där filen finns: + + FILE + Väljer alla filer med namnet FILE i denna katalog eller under. + Detta följer samma globbing-regler som det globala mönstret. + + DIR/ + Väljer alla kataloger med namnet DIR och allt innehåll, som finns + i denna katalog eller under. + + /PATH/FILE + Väljer den exakt angivna filen relativt platsen för + `.snapraidignore`-filen. + + /PATH/DIR/ + Väljer den exakt angivna katalogen och allt innehåll, relativt + platsen för `.snapraidignore`-filen. + +Till skillnad från den globala konfigurationen stöder `.snapraidignore`-filer +endast exkluderingsregler; du kan inte använda `include`-mönster eller negation (!). + +Till exempel, om du har en `.snapraidignore` i `/mnt/disk1/projects/`: + + # Exkluderar ENDAST /mnt/disk1/projects/output.bin + /output.bin + # Exkluderar alla kataloger med namnet 'build' inuti projects/ + build/ + # Exkluderar alla .tmp-filer inuti projects/ eller dess undermappar + *.tmp + + +10 INNEHåLL (CONTENT) +===================== SnapRAID lagrar listan och checksummorna för dina filer i content-filen. @@ -1523,7 +1568,7 @@ Denna fil läses och skrivs av kommandona `sync` och `scrub` och läses av kommandona `fix`, `check` och `status`. -10 PARITET (PARITY) +11 PARITET (PARITY) =================== SnapRAID lagrar paritetsinformationen för din array i parity- @@ -1536,7 +1581,7 @@ Dessa filer läses och skrivs av kommandona `sync` och `fix` och läses endast av kommandona `scrub` och `check`. -11 KODNING +12 KODNING ========== SnapRAID i Unix ignorerar all kodning. Det läser och lagrar @@ -1553,13 +1598,13 @@ omdirigerar konsolutdata till en fil, är den resulterande filen alltid i UTF-8-format. -12 UPPHOVSRäTT (COPYRIGHT) +13 UPPHOVSRäTT (COPYRIGHT) ========================== Denna fil är Copyright (C) 2025 Andrea Mazzoleni -13 SE ÄVEN (SEE ALSO) +14 SE ÄVEN (SEE ALSO) ===================== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-uk.1 b/doc/snapraid-uk.1 index 26387a62..608f3e2f 100644 --- a/doc/snapraid-uk.1 +++ b/doc/snapraid-uk.1 @@ -2056,6 +2056,66 @@ snapraid \-f \[dq]*.mp3\[dq] check В Unix, при використанні символів глоббінгу в командному рядку, ви повинні взяти їх у лапки, щоб запобігти їх розширенню оболонкою. +.SH Ігнорування файлів (IGNORE FILE) +На додаток до глобальних правил у файлі конфігурації, ви можете розміщувати +файли \`.snapraidignore\` в будь\-якому каталозі всередині масиву для визначення +децентралізованих правил виключення. +.PP +Правила, визначені в \`.snapraidignore\`, застосовуються після правил у файлі +конфігурації. Це означає, що вони мають вищий пріоритет і можуть бути використані +для виключення файлів, які раніше були включені глобальною конфігурацією. +Фактично, якщо локальне правило збігається, файл виключається незалежно від +глобальних налаштувань включення. +.PP +Логіка шаблонів у \`.snapraidignore\` повторює глобальну конфігурацію, але +прив\'язує шаблони до каталогу, в якому знаходиться файл: +.TP +.B FILE +Вибирає будь\-який файл із ім\'ям FILE у цьому каталозі або нижче. +Це відповідає тим самим правилам підстановки, що і в глобальному шаблоні. +.TP +.B DIR/ +Вибирає будь\-який каталог із ім\'ям DIR та весь його вміст, що +знаходиться в цьому каталозі або нижче. +.TP +.B /PATH/FILE +Вибирає точно вказаний файл відносно розташування +файлу \`.snapraidignore\`. +.TP +.B /PATH/DIR/ +Вибирає точно вказаний каталог та весь його вміст відносно +розташування файлу \`.snapraidignore\`. +.PP +На відміну від глобальної конфігурації, файли \`.snapraidignore\` підтримують +лише правила виключення; ви не можете використовувати шаблони \`include\` або заперечення (!). +.PP +Наприклад, якщо у вас є \`.snapraidignore\` у \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Виключає ТІЛЬКИ /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Виключає будь\-який каталог із назвою \'build\' всередині projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Виключає будь\-який .tmp файл всередині projects/ або його підпапок +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH Вміст (CONTENT) SnapRAID зберігає список та контрольні суми ваших файлів у файлі вмісту. diff --git a/doc/snapraid-uk.d b/doc/snapraid-uk.d index 7ee1f977..8ecc5c0f 100644 --- a/doc/snapraid-uk.d +++ b/doc/snapraid-uk.d @@ -1603,6 +1603,48 @@ Name{number} командному рядку, ви повинні взяти їх у лапки, щоб запобігти їх розширенню оболонкою. +Ігнорування файлів (Ignore File) + На додаток до глобальних правил у файлі конфігурації, ви можете розміщувати + файли `.snapraidignore` в будь-якому каталозі всередині масиву для визначення + децентралізованих правил виключення. + + Правила, визначені в `.snapraidignore`, застосовуються після правил у файлі + конфігурації. Це означає, що вони мають вищий пріоритет і можуть бути використані + для виключення файлів, які раніше були включені глобальною конфігурацією. + Фактично, якщо локальне правило збігається, файл виключається незалежно від + глобальних налаштувань включення. + + Логіка шаблонів у `.snapraidignore` повторює глобальну конфігурацію, але + прив'язує шаблони до каталогу, в якому знаходиться файл: + + =FILE + Вибирає будь-який файл із ім'ям FILE у цьому каталозі або нижче. + Це відповідає тим самим правилам підстановки, що і в глобальному шаблоні. + + =DIR/ + Вибирає будь-який каталог із ім'ям DIR та весь його вміст, що + знаходиться в цьому каталозі або нижче. + + =/PATH/FILE + Вибирає точно вказаний файл відносно розташування + файлу `.snapraidignore`. + + =/PATH/DIR/ + Вибирає точно вказаний каталог та весь його вміст відносно + розташування файлу `.snapraidignore`. + + На відміну від глобальної конфігурації, файли `.snapraidignore` підтримують + лише правила виключення; ви не можете використовувати шаблони `include` або заперечення (!). + + Наприклад, якщо у вас є `.snapraidignore` у `/mnt/disk1/projects/`: + + :# Виключає ТІЛЬКИ /mnt/disk1/projects/output.bin + :/output.bin + :# Виключає будь-який каталог із назвою 'build' всередині projects/ + :build/ + :# Виключає будь-який .tmp файл всередині projects/ або його підпапок + :*.tmp + Вміст (Content) SnapRAID зберігає список та контрольні суми ваших файлів у файлі вмісту. diff --git a/doc/snapraid-uk.txt b/doc/snapraid-uk.txt index e4f4a6eb..cfe50697 100644 --- a/doc/snapraid-uk.txt +++ b/doc/snapraid-uk.txt @@ -1703,8 +1703,53 @@ PARITY — це одне з імен парності: `parity`, щоб запобігти їх розширенню оболонкою. -9 Вміст (CONTENT) -================= +9 Ігнорування файлів (IGNORE FILE) +================================== + +На додаток до глобальних правил у файлі конфігурації, ви можете розміщувати +файли `.snapraidignore` в будь-якому каталозі всередині масиву для визначення +децентралізованих правил виключення. + +Правила, визначені в `.snapraidignore`, застосовуються після правил у файлі +конфігурації. Це означає, що вони мають вищий пріоритет і можуть бути використані +для виключення файлів, які раніше були включені глобальною конфігурацією. +Фактично, якщо локальне правило збігається, файл виключається незалежно від +глобальних налаштувань включення. + +Логіка шаблонів у `.snapraidignore` повторює глобальну конфігурацію, але +прив'язує шаблони до каталогу, в якому знаходиться файл: + + FILE + Вибирає будь-який файл із ім'ям FILE у цьому каталозі або нижче. + Це відповідає тим самим правилам підстановки, що і в глобальному шаблоні. + + DIR/ + Вибирає будь-який каталог із ім'ям DIR та весь його вміст, що + знаходиться в цьому каталозі або нижче. + + /PATH/FILE + Вибирає точно вказаний файл відносно розташування + файлу `.snapraidignore`. + + /PATH/DIR/ + Вибирає точно вказаний каталог та весь його вміст відносно + розташування файлу `.snapraidignore`. + +На відміну від глобальної конфігурації, файли `.snapraidignore` підтримують +лише правила виключення; ви не можете використовувати шаблони `include` або заперечення (!). + +Наприклад, якщо у вас є `.snapraidignore` у `/mnt/disk1/projects/`: + + # Виключає ТІЛЬКИ /mnt/disk1/projects/output.bin + /output.bin + # Виключає будь-який каталог із назвою 'build' всередині projects/ + build/ + # Виключає будь-який .tmp файл всередині projects/ або його підпапок + *.tmp + + +10 Вміст (CONTENT) +================== SnapRAID зберігає список та контрольні суми ваших файлів у файлі вмісту. @@ -1719,7 +1764,7 @@ SnapRAID зберігає список та контрольні суми `check` та `status`. -10 Парність (PARITY) +11 Парність (PARITY) ==================== SnapRAID зберігає інформацію парності вашого @@ -1734,7 +1779,7 @@ SnapRAID зберігає інформацію парності вашого `scrub` та `check`. -11 Кодування (ENCODING) +12 Кодування (ENCODING) ======================= SnapRAID в Unix ігнорує будь-яке кодування. @@ -1758,13 +1803,13 @@ TrueType, такий як `Lucida Console`, як буде у форматі UTF-8. -12 Авторське право (COPYRIGHT) +13 Авторське право (COPYRIGHT) ============================== Цей файл захищений авторським правом (C) 2025 Andrea Mazzoleni -13 Див. також (SEE ALSO) +14 Див. також (SEE ALSO) ======================== snapraid_log(1), rsync(1) diff --git a/doc/snapraid-zh.1 b/doc/snapraid-zh.1 index 7a4b37a6..32a27e4e 100644 --- a/doc/snapraid-zh.1 +++ b/doc/snapraid-zh.1 @@ -1700,6 +1700,62 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP 在 Unix 中,在命令行上使用 globbing 字符时,必须 引用它们以防止 shell 扩展它们。 +.SH IGNORE FILE +除了配置文件中的全局规则外,您还可以在阵列内的任何目录中放置 +\`.snapraidignore\` 文件,以定义分散的排除规则。 +.PP +在 \`.snapraidignore\` 中定义的规则会在配置文件中的规则之后应用。 +这意味着它们具有更高的优先级,可用于排除先前由全局配置包含的文件。 +实际上,如果本地规则匹配,则无论全局包含设置如何,该文件都会被排除。 +.PP +\`.snapraidignore\` 中的模式逻辑与全局配置相同,但模式锚定在 +该文件所在的目录: +.TP +.B FILE +选择此目录或其下方任何名为 FILE 的文件。 +这遵循与全局模式相同的通配符规则。 +.TP +.B DIR/ +选择任何名为 DIR 的目录及其内部的所有内容, +位于此目录或其下方。 +.TP +.B /PATH/FILE +选择相对于 \`.snapraidignore\` 文件位置指定的精确文件。 +.TP +.B /PATH/DIR/ +选择相对于 \`.snapraidignore\` 文件位置指定的精确目录 +及其内部的所有内容。 +.PP +与全局配置不同,\`.snapraidignore\` 文件仅支持排除规则; +您不能使用 \`include\` 模式或否定符号 (!)。 +.PP +例如,如果您在 \`/mnt/disk1/projects/\` 中有一个 \`.snapraidignore\`: +.PP +.RS 4 +# 仅排除 /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# 排除 projects/ 中任何名为 \'build\' 的目录 +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# 排除 projects/ 或其子文件夹中任何 .tmp 文件 +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID 将文件列表和校验和存储在 content 文件中。 .PP diff --git a/doc/snapraid-zh.d b/doc/snapraid-zh.d index 07b2122a..95963c12 100644 --- a/doc/snapraid-zh.d +++ b/doc/snapraid-zh.d @@ -1261,6 +1261,44 @@ Pattern 在 Unix 中,在命令行上使用 globbing 字符时,必须 引用它们以防止 shell 扩展它们。 +Ignore File + 除了配置文件中的全局规则外,您还可以在阵列内的任何目录中放置 + `.snapraidignore` 文件,以定义分散的排除规则。 + + 在 `.snapraidignore` 中定义的规则会在配置文件中的规则之后应用。 + 这意味着它们具有更高的优先级,可用于排除先前由全局配置包含的文件。 + 实际上,如果本地规则匹配,则无论全局包含设置如何,该文件都会被排除。 + + `.snapraidignore` 中的模式逻辑与全局配置相同,但模式锚定在 + 该文件所在的目录: + + =FILE + 选择此目录或其下方任何名为 FILE 的文件。 + 这遵循与全局模式相同的通配符规则。 + + =DIR/ + 选择任何名为 DIR 的目录及其内部的所有内容, + 位于此目录或其下方。 + + =/PATH/FILE + 选择相对于 `.snapraidignore` 文件位置指定的精确文件。 + + =/PATH/DIR/ + 选择相对于 `.snapraidignore` 文件位置指定的精确目录 + 及其内部的所有内容。 + + 与全局配置不同,`.snapraidignore` 文件仅支持排除规则; + 您不能使用 `include` 模式或否定符号 (!)。 + + 例如,如果您在 `/mnt/disk1/projects/` 中有一个 `.snapraidignore`: + + :# 仅排除 /mnt/disk1/projects/output.bin + :/output.bin + :# 排除 projects/ 中任何名为 'build' 的目录 + :build/ + :# 排除 projects/ 或其子文件夹中任何 .tmp 文件 + :*.tmp + Content SnapRAID 将文件列表和校验和存储在 content 文件中。 diff --git a/doc/snapraid-zh.txt b/doc/snapraid-zh.txt index ae444847..0f643a02 100644 --- a/doc/snapraid-zh.txt +++ b/doc/snapraid-zh.txt @@ -1361,8 +1361,49 @@ globbing 字符。在 Unix 中,转义字符是 '\';在 Windows 中,它是 引用它们以防止 shell 扩展它们。 -9 CONTENT -========= +9 IGNORE FILE +============= + +除了配置文件中的全局规则外,您还可以在阵列内的任何目录中放置 +`.snapraidignore` 文件,以定义分散的排除规则。 + +在 `.snapraidignore` 中定义的规则会在配置文件中的规则之后应用。 +这意味着它们具有更高的优先级,可用于排除先前由全局配置包含的文件。 +实际上,如果本地规则匹配,则无论全局包含设置如何,该文件都会被排除。 + +`.snapraidignore` 中的模式逻辑与全局配置相同,但模式锚定在 +该文件所在的目录: + + FILE + 选择此目录或其下方任何名为 FILE 的文件。 + 这遵循与全局模式相同的通配符规则。 + + DIR/ + 选择任何名为 DIR 的目录及其内部的所有内容, + 位于此目录或其下方。 + + /PATH/FILE + 选择相对于 `.snapraidignore` 文件位置指定的精确文件。 + + /PATH/DIR/ + 选择相对于 `.snapraidignore` 文件位置指定的精确目录 + 及其内部的所有内容。 + +与全局配置不同,`.snapraidignore` 文件仅支持排除规则; +您不能使用 `include` 模式或否定符号 (!)。 + +例如,如果您在 `/mnt/disk1/projects/` 中有一个 `.snapraidignore`: + + # 仅排除 /mnt/disk1/projects/output.bin + /output.bin + # 排除 projects/ 中任何名为 'build' 的目录 + build/ + # 排除 projects/ 或其子文件夹中任何 .tmp 文件 + *.tmp + + +10 CONTENT +========== SnapRAID 将文件列表和校验和存储在 content 文件中。 @@ -1373,7 +1414,7 @@ SnapRAID 将文件列表和校验和存储在 content 文件中。 `fix`、`check` 和 `status` 命令读取。 -10 PARITY +11 PARITY ========= SnapRAID 将阵列的奇偶校验信息存储在 parity 文件中。 @@ -1385,7 +1426,7 @@ SnapRAID 将阵列的奇偶校验信息存储在 parity 文件中。 并且仅由 `scrub` 和 `check` 命令读取。 -11 ENCODING +12 ENCODING =========== SnapRAID 在 Unix 中忽略任何编码。它读取并存储 @@ -1401,13 +1442,13 @@ SnapRAID 在 Unix 中忽略任何编码。它读取并存储 采用 UTF-8 格式。 -12 COPYRIGHT +13 COPYRIGHT ============ 此文件版权所有 (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1) diff --git a/doc/snapraid.1 b/doc/snapraid.1 index c6005917..856c656f 100644 --- a/doc/snapraid.1 +++ b/doc/snapraid.1 @@ -1852,6 +1852,66 @@ snapraid \-f \[dq]*.mp3\[dq] check .PP In Unix, when using globbing characters on the command line, you must quote them to prevent the shell from expanding them. +.SH IGNORE FILE +In addition to the global rules in the configuration file, you can +place \`.snapraidignore\` files in any directory within the array to +define decentralized exclusion rules. +.PP +Rules defined in \`.snapraidignore\` are applied after the rules in the +configuration file. This means they have a higher priority and can be +used to exclude files that were previously included by the global +configuration. Effectively, if a local rule matches, the file is +excluded regardless of the global include settings. +.PP +The pattern logic in \`.snapraidignore\` mirrors the global configuration +but anchors patterns to the directory where the file is located: +.TP +.B FILE +Selects any file named FILE in this directory or below. +This follows the same globbing rules as the global pattern. +.TP +.B DIR/ +Selects any directory named DIR and everything inside, +residing in this directory or below. +.TP +.B /PATH/FILE +Selects the exact specified file relative to the location +of the \`.snapraidignore\` file. +.TP +.B /PATH/DIR/ +Selects the exact specified directory and everything inside, +relative to the location of the \`.snapraidignore\` file. +.PP +Unlike the global configuration, \`.snapraidignore\` files only support +exclusion rules; you cannot use \`include\` patterns or negation (!). +.PP +For example, if you have a \`.snapraidignore\` in \`/mnt/disk1/projects/\`: +.PP +.RS 4 +# Excludes ONLY /mnt/disk1/projects/output.bin +.PD 0 +.PP +.PD +/output.bin +.PD 0 +.PP +.PD +# Excludes any directory named \'build\' inside projects/ +.PD 0 +.PP +.PD +build/ +.PD 0 +.PP +.PD +# Excludes any .tmp file inside projects/ or its subfolders +.PD 0 +.PP +.PD +*.tmp +.PD 0 +.PD +.RE .SH CONTENT SnapRAID stores the list and checksums of your files in the content file. .PP diff --git a/doc/snapraid.d b/doc/snapraid.d index 47d1d212..7dae79a1 100644 --- a/doc/snapraid.d +++ b/doc/snapraid.d @@ -1413,6 +1413,48 @@ Pattern In Unix, when using globbing characters on the command line, you must quote them to prevent the shell from expanding them. +Ignore File + In addition to the global rules in the configuration file, you can + place `.snapraidignore` files in any directory within the array to + define decentralized exclusion rules. + + Rules defined in `.snapraidignore` are applied after the rules in the + configuration file. This means they have a higher priority and can be + used to exclude files that were previously included by the global + configuration. Effectively, if a local rule matches, the file is + excluded regardless of the global include settings. + + The pattern logic in `.snapraidignore` mirrors the global configuration + but anchors patterns to the directory where the file is located: + + =FILE + Selects any file named FILE in this directory or below. + This follows the same globbing rules as the global pattern. + + =DIR/ + Selects any directory named DIR and everything inside, + residing in this directory or below. + + =/PATH/FILE + Selects the exact specified file relative to the location + of the `.snapraidignore` file. + + =/PATH/DIR/ + Selects the exact specified directory and everything inside, + relative to the location of the `.snapraidignore` file. + + Unlike the global configuration, `.snapraidignore` files only support + exclusion rules; you cannot use `include` patterns or negation (!). + + For example, if you have a `.snapraidignore` in `/mnt/disk1/projects/`: + + :# Excludes ONLY /mnt/disk1/projects/output.bin + :/output.bin + :# Excludes any directory named 'build' inside projects/ + :build/ + :# Excludes any .tmp file inside projects/ or its subfolders + :*.tmp + Content SnapRAID stores the list and checksums of your files in the content file. diff --git a/doc/snapraid.txt b/doc/snapraid.txt index 5062aaca..7c515e72 100644 --- a/doc/snapraid.txt +++ b/doc/snapraid.txt @@ -1513,8 +1513,53 @@ In Unix, when using globbing characters on the command line, you must quote them to prevent the shell from expanding them. -9 CONTENT -========= +9 IGNORE FILE +============= + +In addition to the global rules in the configuration file, you can +place `.snapraidignore` files in any directory within the array to +define decentralized exclusion rules. + +Rules defined in `.snapraidignore` are applied after the rules in the +configuration file. This means they have a higher priority and can be +used to exclude files that were previously included by the global +configuration. Effectively, if a local rule matches, the file is +excluded regardless of the global include settings. + +The pattern logic in `.snapraidignore` mirrors the global configuration +but anchors patterns to the directory where the file is located: + + FILE + Selects any file named FILE in this directory or below. + This follows the same globbing rules as the global pattern. + + DIR/ + Selects any directory named DIR and everything inside, + residing in this directory or below. + + /PATH/FILE + Selects the exact specified file relative to the location + of the `.snapraidignore` file. + + /PATH/DIR/ + Selects the exact specified directory and everything inside, + relative to the location of the `.snapraidignore` file. + +Unlike the global configuration, `.snapraidignore` files only support +exclusion rules; you cannot use `include` patterns or negation (!). + +For example, if you have a `.snapraidignore` in `/mnt/disk1/projects/`: + + # Excludes ONLY /mnt/disk1/projects/output.bin + /output.bin + # Excludes any directory named 'build' inside projects/ + build/ + # Excludes any .tmp file inside projects/ or its subfolders + *.tmp + + +10 CONTENT +========== SnapRAID stores the list and checksums of your files in the content file. @@ -1525,7 +1570,7 @@ This file is read and written by the `sync` and `scrub` commands and read by the `fix`, `check`, and `status` commands. -10 PARITY +11 PARITY ========= SnapRAID stores the parity information of your array in the parity @@ -1538,7 +1583,7 @@ These files are read and written by the `sync` and `fix` commands and only read by the `scrub` and `check` commands. -11 ENCODING +12 ENCODING =========== SnapRAID in Unix ignores any encoding. It reads and stores the @@ -1555,13 +1600,13 @@ redirect the console output to a file, the resulting file is always in UTF-8 format. -12 COPYRIGHT +13 COPYRIGHT ============ This file is Copyright (C) 2025 Andrea Mazzoleni -13 SEE ALSO +14 SEE ALSO =========== snapraid_log(1), rsync(1)