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

etcdctl recursive delete with wildcards #2385

Closed
timothysc opened this issue Feb 26, 2015 · 12 comments
Closed

etcdctl recursive delete with wildcards #2385

timothysc opened this issue Feb 26, 2015 · 12 comments

Comments

@timothysc
Copy link

There are times where is would be very useful to recursively delete based on wildcard.

e.g. rm -rf /foo/bar/*

@yichengq
Copy link
Contributor

We have remove recursively functonality:

unihorn@CoreOS ~/g/s/g/c/etcd> ./bin/etcdctl --no-sync rm --help
   rm - remove a key

USAGE:
   command rm [command options] [arguments...]

OPTIONS:
   --dir        removes the key if it is an empty directory or a key-value pair
   --recursive      removes the key and all child keys(if it is a directory)
   --with-value     previous value
   --with-index '0' previous index

@timothysc timothysc changed the title etcdctl recursive delete etcdctl recursive delete with wildcards Feb 26, 2015
@timothysc
Copy link
Author

what about the wild-cards?

--recursive removes the key and all child keys(if it is a directory)

@kelseyhightower
Copy link
Contributor

@timothysc What you want here is the ability to do this:

Give the following keys:

/foo/bar/a
/foo/bar/b
/foo/bar/dir/a
/foo/bar/dir/b

After running the following command:

rm -rf /foo/bar/*

You want the following keys to exist:

/foo/bar/dir/a
/foo/bar/dir/b

Does that look right?

@timothysc
Copy link
Author

@kelseyhightower yup.

@olibob
Copy link

olibob commented Mar 3, 2015

I ended up here looking exactly for what's requested. I ended up doing a etcdctl ls -recursive, greping for the keys I wanted to remove and feeding them to etcdctl rm

@timothysc
Copy link
Author

@olibob great minds think alike ;-)

Anyway... I know upstream is not to keen on treating it as a file-system, but users would ideally like to perform all the traditional ops. IMHO a fuse mount would enable, and folks could just say they will not support the entirety of POSIX semantics.

Then I could just perform traditional shell commands and be done with it vs. trying to force fit through etcdctl

@jeremyeder
Copy link

Sounds like I'm not the only one that wants etcdctl to become a full-fledged etcd CLI client...

@iby
Copy link

iby commented Oct 6, 2015

👍

@cgonyeo
Copy link

cgonyeo commented Feb 21, 2016

Just chanced across this, but wouldn't the shell fill in the * before passing it into etcdctl?

@xiang90 xiang90 added this to the unplanned milestone May 10, 2016
@xiang90
Copy link
Contributor

xiang90 commented Oct 17, 2016

I am inclined to close this. We do not actively working on v2 anymore. v3 does not support the concept of dir, so this is not an issue anymore.

@timothysc
Copy link
Author

sgtm

@rustyx
Copy link

rustyx commented Apr 6, 2020

For etcd v3 use etcdctl del --prefix=true <prefix>

That will delete everything starting with <prefix>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

9 participants