Created
December 16, 2019 16:50
-
-
Save Devp00l/2473f5953d578f440fc71b3d602a9c23 to your computer and use it in GitHub Desktop.
A way to delete all CephFS snapshots in a given directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#$1 = CephFS directory | |
# Snapshots starting with underscore names are related to snapshots based in a higher directory and can't be used. | |
# Therefore they are filterd out with `grep` | |
find $1 -type d | while read i; do | |
ls --color=none $i/.snap | while read j; do | |
echo $i/.snap/$j | |
done | |
done | grep --color=never ".snap/[^_]" | xargs rmdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment