backup-mobile (1043B)
1 #!/bin/sh 2 3 readonly DCIM="${HOME}/storage/dcim/" 4 readonly PICTURES="${HOME}/storage/pictures/" 5 readonly MOVIES="${HOME}/storage/movies/" 6 readonly DOWNLOADS="${HOME}/storage/downloads/" 7 8 if [ "$(uname -o)" != "Android" ]; then 9 err "$0: not on mobile device" 10 exit 1 11 fi 12 13 host="$1" 14 15 if [ -d "${DCIM}" ]; then 16 printf "backing up %s\n" "${DCIM}" 17 18 rsync --archive --remove-source-files --verbose --mkpath "${DCIM}" \ 19 "dwrz@${host}:/home/dwrz/mobile/dcim/" 20 fi 21 22 if [ -d "${PICTURES}" ]; then 23 printf "backing up %s\n" "${PICTURES}" 24 25 rsync --archive --remove-source-files --verbose --mkpath "${PICTURES}" \ 26 "dwrz@${host}:/home/dwrz/mobile/pictures/" 27 fi 28 29 if [ -d "${MOVIES}" ]; then 30 printf "backing up %s\n" "${MOVIES}" 31 32 rsync --archive --remove-source-files --verbose --mkpath "${MOVIES}" \ 33 "dwrz@${host}:/home/dwrz/mobile/movies/" 34 fi 35 36 if [ -d "${DOWNLOADS}" ]; then 37 printf "backing up %s\n" "${DOWNLOADS}" 38 39 rsync --archive --remove-source-files --verbose --mkpath "${DOWNLOADS}" \ 40 "dwrz@${host}:/home/dwrz/mobile/downloads/" 41 fi