Skip to content

Instantly share code, notes, and snippets.

@raid5
Created March 27, 2011 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raid5/888840 to your computer and use it in GitHub Desktop.
Save raid5/888840 to your computer and use it in GitHub Desktop.
A simple shell script to sync media to my Atrix (android) phone.
#!/bin/sh
RSYNC_DEFAULT_OPTIONS="-r -t -v -L --ignore-existing --delete --stats --progress"
RSYNC_TEMP_DIR="./tmp_rsync_dir/"
# Sources
ITUNES_PODCASTS_DIR="/Users/adam/Music/iTunes/iTunes Music/Podcasts/"
ITUNES_MUSIC_DIR="/Users/adam/Music/iTunes/iTunes Music/"
ALBUMS=(
"Bone Thugs-N-Harmony/Strength & Loyalty"
"Bone Thugs-N-Harmony/The Collection Volume Two"
"Forever The Sickest Kids/Forever The Sickest Kids"
"Eminem/The Slim Shady LP"
"Rebelution/Bright Side Of Life"
"Rebelution/Courage To Grow"
"Rise Against/Endgame"
"The Ataris/So Long, Astoria"
"The Rocket Summer/Of Men And Angels"
"Thrice/Beggars"
"Thrice/Vheissu"
)
# Destinations
ATRIX_PODCASTS_DIR="/Volumes/ATRIXSD/Podcasts/"
ATRIX_MUSIC_DIR="/Volumes/ATRIXSD/Music/"
# Sync podcasts
rsync $RSYNC_DEFAULT_OPTIONS "$ITUNES_PODCASTS_DIR" "$ATRIX_PODCASTS_DIR"
# Sync music
for album in "${ALBUMS[@]}"; do
mkdir -p "${RSYNC_TEMP_DIR}${album}"
ln -fs "${ITUNES_MUSIC_DIR}${album}" "${RSYNC_TEMP_DIR}${album}"
done
rsync $RSYNC_DEFAULT_OPTIONS "$RSYNC_TEMP_DIR" "$ATRIX_MUSIC_DIR"
rm -rf "${RSYNC_TEMP_DIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment