Get photos off your Android phone with GPhoto2

Being an ardent Linux user, I researched how I could get photos off my Galaxy SII. This is not possible with MSD (mass storage device) mode which implies a FAT file system and also implies exclusive access to the file system (but your phone doesn’t stop running when you plug it in). You have to use the PTP (photo transfer protocol) or MTP (media transfer protocol). And you can script this access with Gphoto2.

To detect the device, start with: gphoto2 --auto-detect

To list all your folders and files: gphoto2 -L You will find this far too much to look through.

So, time for grep: gphoto2 -L | fgrep ' folder ' And this will list your folders. You are looking for things like ‘DCIM’ and ‘Camera’ likely.

You will also have multiple storage areas, like your USB storage, and your micro SD card. Sort that out with:
gphoto2 -L | grep folder | awk -F/ '{print $2}' | sort | uniq and I found I had these two storage devices:


Another good search of folders with DCIM gave me these folders:


Alternatively, you can find items in other folders, like all movies:
gphoto2 -L -f/store_00020002/ | egrep -ie 'mov|vid|wmv|mp4|mkv$'

And I hope you find this useful!

One response to “Get photos off your Android phone with GPhoto2”

%d bloggers like this: