Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request for --include and --exclude filters #266

Closed
echan5 opened this issue Jan 4, 2021 · 7 comments · Fixed by #334
Closed

Feature request for --include and --exclude filters #266

echan5 opened this issue Jan 4, 2021 · 7 comments · Fixed by #334
Assignees
Milestone

Comments

@echan5
Copy link

echan5 commented Jan 4, 2021

Hi, this is a feature request. awscli has --include and --exclude filters and it would be great if s5cmd also had those options!

@seruman
Copy link
Member

seruman commented Jul 12, 2021

Hi @echan5. It would be great for us if you and other requester could share what kind of use cases you have in mind? That would help us to better grasp it and decide how to put it with the current feature set (e.g wildcard support).

@echan5
Copy link
Author

echan5 commented Jul 12, 2021

@seruman - essentially, feature parity with awcli would be great! https://docs.aws.amazon.com/cli/latest/reference/s3/#use-of-exclude-and-include-filters
Examples include using --include "*.txt" to include/exclude certain file types, or --exclude "abc*" to include/exclude any file that starts with prefix "abc". Thank you for looking into this request!

@nelhage
Copy link
Contributor

nelhage commented Jul 12, 2021

I'd also have a use case for this; I tried to work around using cp commands in s5cmd run mode, but have been blocked by #301 from actually deploying it in our environment.

In our particular case, we're storing ML models, and we store parameters, and some optimizer states (ADAM moments) alongside the parameters. When we're restoring a model to do inference, we would like to be able to s5cmd cp the relevant parameters to local disk, but ignore the optimizer moments, which are stored with consistent filenames. In our case, that looks something like --exclude=*_moment.dat.

@seruman
Copy link
Member

seruman commented Jul 14, 2021

Thank you both @echan5, @nelhage, what's your thoughts on adding include/exclude options those support regex patterns?

@nelhage
Copy link
Contributor

nelhage commented Jul 14, 2021

I'd be fine with regexes for my use case. I would find it a bit surprising -- include/exclude in every other command I can think of offhand uses some form of glob syntax -- but I could live with it and it would potentially be a nice bit of flexibility.

@echan5
Copy link
Author

echan5 commented Jul 14, 2021

It would be the same for me - I don't think I'd need regex patterns for my current use case, but it could be nice to have that flexibility

seruman pushed a commit that referenced this issue Aug 6, 2021
* `--exclude` flag is implemented in `rm`, `ls`, `cp`, `du` and `select`. 
* `--exclude` flag is used to exclude objects which fits to given pattern. 
* all command tests are included apart from `select`. 

Resolves #266
@seruman
Copy link
Member

seruman commented Aug 12, 2021

I would find it a bit surprising -- include/exclude in every other command I can think of offhand uses some form of glob syntax --

Given s5cmd already supports glob syntax, regex would have been weird as you mentioned. --exclude option is implemented thanks to the @ocakhasan, could you give it a try from master branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants