mpifileutils
mpifileutils copied to clipboard
[Request] Add exclude option to dcp/dsync
It would be advantageous to have an option to exclude file and directory paths when doing a large copy or sync, much like rsync's --exclude. For instance, dsync --exclude DONTMOVE would skip any directories named DONTMOVE in the sync.
Bump on this, drying to use dfind/dwalk on filesystems with .snapshot
paths and it walks and adds all the files in the snapshot. Looking for an exclude option would really help.
I looked at the code and I have a working version on my own fork, it's not perfect but it's a blend of MFU_PRED_REGEX
and mfu_filter_list_regex
In src/common/mfu_pred.c
int MFU_PRED_EREGEX (mfu_flist flist, uint64_t idx, void* arg)
{
/* run regex on full path and return things that don't match */
regex_t* regex = (regex_t*) arg;
const char* name = mfu_flist_file_get_name(flist, idx);
int regex_return = regexec(regex, name, 0, NULL, 0);
int ret = (regex_return == REG_NOMATCH) ? 1 : 0;
return ret;
}
This created a new predicate that only matches a file if it doesn't match the regex provided. I'm testing this right now with excluding the .snapshot
paths in the root of some NFS filers. I'll report back, I likely won't go through the effort to add it to anything other than dwalk
and dfind
but it could be easily added to any of the commands that use the predicate system.
@brockpalen did you have any chances to test --exclude option with dsync? it would be great if you can share patch. "--exclude" is definitely useful option and many people are using with rsync today.