Skip to content

Instantly share code, notes, and snippets.

@atomicstack
Created October 1, 2010 20:43
Show Gist options
  • Save atomicstack/606825 to your computer and use it in GitHub Desktop.
Save atomicstack/606825 to your computer and use it in GitHub Desktop.
make a .tar.gz snapshot of a specific minecraft world, and copy to dropbox dir
#!/bin/bash
save_dir="$HOME/Library/Application Support/minecraft/saves"
dropbox_dir="$HOME/Dropbox/minecraft/world1_backups/"
dest_file=$( date '+%Y%m%d_%H%M%S.tar.gz' )
world=$1
test -z "$world" && world=World1
cd "$save_dir"
target_size=$(du -sb "$world" | awk '{print $1}')
( tar -cf - "$world" | pv -N $dest_file -s $target_size | gzip ) > /tmp/$dest_file
mv -v /tmp/$dest_file "$dropbox_dir/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment