12.1 Update: removed paths, added exclude, updated adb-sync
This commit is contained in:
parent
91a2ff01c3
commit
db67408ac9
7 changed files with 74 additions and 878 deletions
57
mobisync.sh
57
mobisync.sh
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/zsh
|
||||
# This script syncs an Android with a Mac using adb and adb-sync.
|
||||
# Version 12.0 (27 March 2021)
|
||||
# Moved to backup sync as main way to sync. No more file deletion from this script. Documents syncing added.
|
||||
# Version 12.1 (09 June 2021)
|
||||
# Added excluding .DS_Store. Unfortunately can only exclude one file
|
||||
|
||||
# Export paths for use if the script is turned into an app using Platypus.
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
|
@ -11,23 +11,6 @@ export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/$"
|
|||
# Sets the local paths
|
||||
export LOG=~/Library/Logs/mobisync.log
|
||||
export DOWNLOADS=~/Downloads/
|
||||
export BACKUP=~/Mobile/Backup/
|
||||
export AUTOMATE=~/Mobile/Automate/
|
||||
export RESTORE=~/Mobile/Restore/
|
||||
export MUSIC=~/Music/
|
||||
export DOCUMENTS=~/Documents/
|
||||
|
||||
# Sets the remote paths
|
||||
export REMOTE_IMAGES="/sdcard/DCIM/"
|
||||
export REMOTE_PICTURES="/sdcard/Pictures/"
|
||||
export REMOTE_THUMBNAILS="/sdcard/Pictures/.thumbnails/"
|
||||
export REMOTE_AUDIO="/sdcard/Audio/"
|
||||
export REMOTE_MUSIC="/sdcard/Music/"
|
||||
export REMOTE_DOCUMENTS="/sdcard/Documents/"
|
||||
export REMOTE_RESTORE="/sdcard/Restore/"
|
||||
export REMOTE_BACKUP="/sdcard/Backup/"
|
||||
export REMOTE_DOWNLOAD="/sdcard/Download/"
|
||||
export REMOTE_AUTOMATE="/sdcard/.automate/"
|
||||
|
||||
# Set error variable
|
||||
ERROR=0
|
||||
|
|
@ -65,30 +48,38 @@ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - >> $LOG # Prints line
|
|||
}
|
||||
|
||||
# Writes the header for the log file: Program, Version number, Date and Line.
|
||||
{ echo "mobisync 12.0"; echo "Log: " `date`; line; } >> $LOG
|
||||
{ echo "mobisync 12.1"; echo "Log: " `date`; line; } >> $LOG
|
||||
|
||||
# Syncing images and video on device to the Downloads folder and sync the wallpaper on computer.
|
||||
{ adb shell find $REMOTE_IMAGES -type f -iname \*.jpg -o -type f -iname \*.mp4 -o -type f -iname \*.dng | tr -d '\015' | while read line; do adb pull "$line" $DOWNLOADS; done; adb shell rm -rf $REMOTE_THUMBNAILS; adb shell find $REMOTE_PICTURES -type f -iname "*.jpg" | tr -d '\015' | while read line; do adb pull "$line" $DOWNLOADS; done; } >> $LOG
|
||||
catcher Images
|
||||
line
|
||||
|
||||
# Syncing audio on device to the Downloads folder on computer and Music from the computer.
|
||||
{ adb shell find $REMOTE_AUDIO -type f -iname \*.mp3 -o -type f -iname \*.ogg | tr -d '\015' | while read line; do adb pull "$line" $DOWNLOADS; done; adb-sync --delete $MUSIC $REMOTE_MUSIC; } >> $LOG
|
||||
catcher Audio
|
||||
# Syncing Music from the computer.
|
||||
{
|
||||
adb-sync --delete --exclude .DS_Store ~/Music/ "/sdcard/Music/";
|
||||
} >> $LOG
|
||||
catcher Music
|
||||
line
|
||||
|
||||
# Syncing documents on device to the Downloads folder on computer.
|
||||
{ adb-sync --two-way $DOCUMENTS $REMOTE_DOCUMENTS; adb-sync --reverse $REMOTE_DOWNLOAD $DOWNLOADS; } >> $LOG
|
||||
{
|
||||
adb-sync --reverse --times "/sdcard/Documents/Checkin/" ~/Documents/Checkin/;
|
||||
adb-sync --reverse --times --delete "/sdcard/Documents/Logistics/" ~/Documents/Logistics/;
|
||||
adb-sync --exclude .DS_Store --delete ~/Documents/Papers.sparsebundle/ "/sdcard/Documents/Papers.sparsebundle/";
|
||||
adb-sync --reverse "/sdcard/Download/" $DOWNLOADS;
|
||||
} >> $LOG
|
||||
catcher Documents
|
||||
line
|
||||
|
||||
# Syncing Automate data on device to the computer
|
||||
{ adb-sync --reverse $REMOTE_AUTOMATE $AUTOMATE; } >> $LOG
|
||||
catcher Tentacles
|
||||
# Syncing Automate data on device to the computer.
|
||||
{
|
||||
adb-sync --two-way --exclude .DS_Store ~/Projects/Programming/push/automate/ "/sdcard/.automate/Interface/";
|
||||
adb-sync --reverse "/sdcard/.automate/" ~/Mobile/Automate/;
|
||||
} >> $LOG
|
||||
catcher Automate
|
||||
line
|
||||
|
||||
# Syncing app, recovery and backups.
|
||||
{ adb-sync --two-way $RESTORE $REMOTE_RESTORE; adb-sync --reverse --delete --times $REMOTE_BACKUP $BACKUP; } >> $LOG
|
||||
{
|
||||
adb-sync --reverse "/sdcard/Restore/" ~/Mobile/Restore/;
|
||||
adb-sync --reverse --times "/sdcard/Backup/" ~/Mobile/Backup/;
|
||||
} >> $LOG
|
||||
catcher Backup
|
||||
line
|
||||
|
||||
|
|
|
|||
Reference in a new issue