Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 36 lines (30 sloc) 964 Bytes
#!/bin/bash
# sync data between phone and laptop over USB
# requires adb-sync
# sync directories TO the phone
adb-sync --delete --force ~/deaddrop/ /sdcard/deaddrop
declare -A backups
backups[DCIM/Camera]=~/photos/android_dump
backups[Pictures]=~/photos/phone_pictures
backups[Tumblr]=~/photos/tumblr
# backup (i.e. don't delete)
# directories FROM the phone
for DIR in "${!backups[@]}"; do
echo "Backing up /sdcard/${DIR} -> ${backups[$DIR]}"
adb-sync --reverse "/sdcard/${DIR}/" "${backups[$DIR]}"
done
# sync select music TO the phone
MUSIC_BASE_DIR=~/musics/
MUSIC_PLAYLIST=~/musics/_playlists/music.m3u
# parse a m3u playlist
function parse_songs() {
while read line; do
echo "${MUSIC_BASE_DIR}${line}"
done <$MUSIC_PLAYLIST
}
# create temporary directory for songs
rm -rf /tmp/musics
mkdir /tmp/musics
parse_songs | xargs -0 -d '\n' -I {} cp {} /tmp/musics/
adb-sync --delete /tmp/musics/ /sdcard/Music/musics
rm -rf /tmp/musics