-
-
Save denismakogon/7081681 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
#you should run this script from directory with unpacked backups | |
#find directory with cassandra/data | |
data_dir=`find . -type d -name data` | |
#looking for all keyspaces in data directory | |
for keyspace in `ls -la ${data_dir} | awk '{print $9}' | grep -v "[.]" | grep -xv ""` | |
do | |
#move all *.db files from direcotory with snapshots to right dirs | |
for directories in `ls -la ${data_dir}/${keyspace} | awk '{print $9}' | grep -v "[.]" | grep -xv ""` | |
do | |
i=`find ${data_dir}/${keyspace}/${directories} -name *.db` | |
mv -f $i ${data_dir}/${keyspace}/${directories}/ | |
done | |
done | |
rm -rf $(find . -type d -name snapshots) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment