s3-cli icon indicating copy to clipboard operation
s3-cli copied to clipboard

sync with filter

Open Tasnim97 opened this issue 4 years ago • 2 comments

I tried adding an --exclude flag when running with sync command and got Incorrect Usage: flag provided but not defined: -exclude and surely enough from help sync, --exclude is not in the options list. I was wondering, since this attempts to be a drop in replacement for s3cmd, if there are plans to allow filtering with the sync command in the future? It would be similar to s3cmd's (under Filtering with —exclude / —include rules)

Tasnim97 avatar Mar 15 '21 07:03 Tasnim97

Good feature request.

Won't speak to the specifics of the timing, but yes.

koblas avatar Mar 16 '21 00:03 koblas

Nice, looking forward for the release.

In the meantime if anyone is looking for a temporary solution, i've hardcoded my exclusion in my own build by modifying buildFileInfo function in cms_sync.go. First thing in the filter function given to filepath.Walk, add a condition that would match all the files and folders you intent to exclude and return nil. Also apparently WalkDir is more efficient than Walk according to this, but in my use case, couldn't tell the difference.

Tasnim97 avatar Mar 19 '21 10:03 Tasnim97