diff --git a/cmdline/scan.c b/cmdline/scan.c index ab17ae03..ec159b08 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -1409,10 +1409,17 @@ static int scan_sub(struct snapraid_scan* scan, int level, int is_diff, char* pa /* LCOV_EXCL_STOP */ } - /* exclude hidden files even before calling lstat() */ + /* + * Exclude hidden files even before calling lstat(). + * Note that .snapraidignore is an exception because it is a control file + * that defines local exclusion rules, and must also be preserved as array + * data so that exclusion rules survive disaster recovery. + */ if (filter_hidden(state->filter_hidden, dd) != 0) { - msg_verbose("Excluding hidden '%s'\n", path_next); - continue; + if (strcmp(".snapraidignore", dd->d_name) != 0) { + msg_verbose("Excluding hidden '%s'\n", path_next); + continue; + } } /* exclude content files even before calling lstat() */