Is there a way to remove empty directories recursively?
Please try etcdctl rmdir command (https://github.com/coreos/etcd/tree/master/etcdctl#deleting-a-key).
rmdir is removes the key if it is an empty directory or a key-value pair
i was thinking of something like lets say
key: value:
/path
/path/ta
/path/ta/key test
/path/to
/path/to/key test
/path/towards
/path/towards/key test
$ etcdctl rm /path/ta/key
$ etcdctl rm /path/to/key
$ etcdctl ls --recursive
/path
/path/ta
/path/to
/path/towards
/path/towards/key
$ etcdctl <somecommand> /path
where <somecommand> will delete both /path/to and /path/ta since these are empty dirs. I'm basically looking for a command to clean up empty folders.
If you want to delete recursively you can do etcdctl rm /path/to/dir --recursive.
But if you want to delete only empty ones, you have to do manually.
Then I have to do manually. I see, thanks!
No problem. Please ask us if you have any questions. Thanks.
Most helpful comment
If you want to delete recursively you can do
etcdctl rm /path/to/dir --recursive.But if you want to delete only empty ones, you have to do manually.