Skip to content

Instantly share code, notes, and snippets.

@denismakogon
Forked from anonymous/gist:7081583
Created October 21, 2013 10:25
Show Gist options
  • Save denismakogon/7081681 to your computer and use it in GitHub Desktop.
Save denismakogon/7081681 to your computer and use it in GitHub Desktop.
#!/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