|
Ever have .apk's or files on your computer that need to be pushed to your android phone? Believe me, I know what a hassle it can be to transfer just a single file, especially when it's the last thing you need to do before hitting the hay at 3 am... Anyhow, now that I'm more or less a strict linux user, I'm porting my windows scripts to make my life easier. I installed ADB (the Android Debugger Bridge for those unaware) to my /usr/bin directory and wrote this little script to transfer files to any phone on my wireless network that has ADB listening over TCP/IP.
I use ADB Konnect on my rooted android to set up the ADB listener, and simply run this script passing it the path to the file I wish to transfer. It uses zenity to query the user for the IP and port that ADB Konnect displays, as well as the destination on the device (/sdcard/ by default), and pushes the file.
I use Nautilus Actions Configuration to add a right-click context menu to my file browser labeled "Push to Android" and have it invoke the script, passing it the currently selected file in browser. That simple. Just remember to disable ADB on your phone when you're finished...
Hope someone finds this useful. I'll link to the requirements below.
IP=$(zenity --entry --text "Android IP: Port" --entry-text "192.168.1.7:5555"); RESULT=$(adb connect $IP); if [[ $RESULT = *connected* ]] then DEST=$(zenity --entry --text "Destination" --entry-text "/sdcard/"); RESULT=$(adb push $1 $DEST 2>&1); zenity --info --text "$RESULT"; else zenity --error --text "ADB could not establish connection!"; fi
Categories: None
The words you entered did not match the given text. Please try again.
Oops!
Oops, you forgot something.