Skip to content

Instantly share code, notes, and snippets.

@hazcod
Last active October 22, 2015 05:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazcod/f6b9e9fc33064482e35b to your computer and use it in GitHub Desktop.
Save hazcod/f6b9e9fc33064482e35b to your computer and use it in GitHub Desktop.
Small script to tar and send over SSH for large compressed files. Rsync is too slow.
#!/bin/sh
IN_DIR=/volume1/Media/Films
OUT_DIR=/mnt/media/movies
REMOTE=nindustries@149.210.164.73
if [ ! -z "$1" ]; then
IN_DIR="$1"
fi
if [ ! -z "$2" ]; then
OUT_DIR="$2"
fi
echo "Transferring from $IN_DIR to $OUT_DIR on $REMOTE"
ssh "$REMOTE" "mkdir -p $OUT_DIR"
for file in "$IN_DIR"; do
echo "Transferring $file"
tar -cp -C "$IN_DIR" "$file" | ssh -c arcfour "$REMOTE" "cat > $OUT_DIR/$file.tar"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment