Skip to content

Instantly share code, notes, and snippets.

@koljenovic
Last active May 18, 2019 12:13
Show Gist options
  • Save koljenovic/65e44f3e0ae51b86f61d907bac5d02a9 to your computer and use it in GitHub Desktop.
Save koljenovic/65e44f3e0ae51b86f61d907bac5d02a9 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
BLK_TARGET=/mnt/chain/blocks #Replace with your destination, no trailing slash
rm -f tomove
find . -name 'rev*.dat' -type f -printf '%f\n' | sort | sed '$d' > tomove
find . -name 'blk*.dat' -type f -printf '%f\n' | sort | sed '$d' >> tomove
while read line; do
echo $line
mv "$line" "$BLK_TARGET/$line"
ln -s "$BLK_TARGET/$line" "$line"
done <tomove
rm tomove
echo Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment