diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-08-20 20:42:02 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-08-20 20:42:02 -0300 |
commit | b2863aca90ce8dfc70e1b004795dcc7d7ea4528e (patch) | |
tree | d3889ee120c01c8dbf511f41df4d73051dce85a4 /android-push | |
download | utils-android-b2863aca90ce8dfc70e1b004795dcc7d7ea4528e.tar.gz utils-android-b2863aca90ce8dfc70e1b004795dcc7d7ea4528e.tar.bz2 |
Initial import
Diffstat (limited to 'android-push')
-rwxr-xr-x | android-push | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/android-push b/android-push new file mode 100755 index 0000000..1eafa10 --- /dev/null +++ b/android-push @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Push and pull to android device. +# + +# Parameters +BASENAME="`basename $0`" +ORIG="$1" +DEST="$2" +ANDROID_BASE="${3:-/storage/emulated/0}" + +# Check +if [ -z "$DEST" ]; then + echo "Usage: $BASENAME <orig> <dest> [android-base]" + echo "" + echo "Examples" + echo "" + echo "android-push /mylocal/music/ Music/" + echo "androis-pull DCIM/Camera /mylocal/camera" + echo "androis-pull Music /mylocal/music" + echo "androis-pull Ringtones /mylocal/ringtones $ANDROID_BASE" + exit 1 +fi + +# Run +if [ "$BASENAME" == "android-pull" ]; then + adb pull $ANDROID_BASE/$ORIG $DEST +else + adb push $ORIG $ANDROID_BASE/$DEST + + # Thanks https://stackoverflow.com/questions/17928576/refresh-android-mediastore-using-adb + #adb shell "find $ANDROID_BASE/$DEST -exec am broadcast \ + #-a android.intent.action.MEDIA_SCANNER_SCAN_FILE \ + #-d file://{} \\;" +fi |