mpifileutils icon indicating copy to clipboard operation
mpifileutils copied to clipboard

[Request] Add exclude option to dcp/dsync

Open cmharr opened this issue 5 years ago • 3 comments

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.

cmharr avatar Aug 28 '19 18:08 cmharr

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.

brockpalen avatar Nov 12 '20 01:11 brockpalen

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 avatar Nov 12 '20 02:11 brockpalen

@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.

sihara avatar Jun 26 '21 11:06 sihara