Skip to content

Instantly share code, notes, and snippets.

@kylerbrown
Created May 29, 2016 18:34
Show Gist options
  • Save kylerbrown/31b6154de57c618e2d05e9fecd7c598e to your computer and use it in GitHub Desktop.
Save kylerbrown/31b6154de57c618e2d05e9fecd7c598e to your computer and use it in GitHub Desktop.
backup script for 24/7 Intan RHD recording
#!/bin/bash
## Rational ##
# A lot of data can be generated quickly with the Intan system. To keep the experimental computer
# from running out of space, the data should be regularly copied to a server and removed locally.
# This script does that safely by:
# 1) recursively copying all *.rhd files and deleting them after safe copy.
# 2) recursively copying everything else, but not deleting (saving notes and settings on the experimenal computer.
## Usage ##
# bash backup.sh LOCAL/DATA/DIRECTORY REMOTE:DATA/DIRECTORY
# Make sure you have shared your ssh keys with the remote computer
local="$1"
remote="$2"
cd $local
find ./ -name "*.rhd" -cmin +11 -print0 | \
rsync -auv --files-from=- --from0 --remove-source-files ./ $remote
find ./ -not -name "*.rhd" -print0 | \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment