Skip to content

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

License

Notifications You must be signed in to change notification settings

alexlab2017/adb_photo_pull

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages