GithubHelp home page GithubHelp logo

alexlab2017 / adb_photo_pull Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 10 KB

Utility to pull the last `n` number of photos from an Android device.

License: MIT License

Shell 100.00%
android ubuntu linux mtp slow connection copy file photo

adb_photo_pull's Introduction

adb_photo_pull Codacy Badge

Utility to pull the last n number of photos from an Android device.

Requirements

  • An Android device
  • Android Debug Bridge (adb) installed
  • bash

On Ubuntu installing adb should be pretty easy: sudo apt install android-tools-adb.

More data on this tool is in the official documentation.

Usage

adb_photo_pull number

The only argument is number and should be an integer.

Copy adb_photo_pull.sh in /usr/local/bin/ to call it form anywhere.

NOTE: Edit the two variables photo_dir and out_dir according to your needs.

Background

With Ubuntu 18.04 came out Bug #1792085. In short, mtp connection become very slow when browsing a folder with lots of files like DCIM/Camera.

I do not have any kind of sync for photos enabled on my phone, neither Google Photos or Samsung Sync or similar.

Sometimes it happens that I have to take a couple of pictures and put them on my laptop to edit or to hand them to a friend on a USB stick and here comes the pain: mtp too slow, bluetooth too slow... how to take this photos out of the phone?!?

I found this interesting article and I decided to give it a try: it really works!

What is a bit annoying is to spawn an adb shell to find out the names of the photos to then adb pull the desired file.

What I need to do is just something like adb pull [last n photos] so I wrote a rough bash script to do so.

Details

Assumption(s):

  • Filenames of photos are in chronological order

You have to enable Developer mode on your phone by tapping multiple times on the Build Number (How to get there differs between Android versions, just do a quick search on the Internet), then go to Developer options and toggle USB debugging on.

You may find this article useful.

Connect the phone to your computer with the USB cable and, when prompted (on the phone) allow the connection.

Security

I never connect my phone to untrusted devices, I charge the phone with my power adapter, not at public charge stations where you connect just the USB cable.

Enabling USB debugging may lead to security related issues (i.e. if you lose your phone), keep this in mind.

adb_photo_pull's People

Contributors

alexlab2017 avatar siriobalmelli avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.