User Tools

Site Tools


copy_all_files_from_sd_card

Copy All Files From SD Card

Jun 2017



To copy all of the files from the SD Card, use the following command:

  gphoto2 --get-all-files


This will start to download the files from the camera. By default, the files will be copied to the present working directory (PWD) of your Raspberry Pi, i.e. the folder that you are in when you execute this command.

Downloading 'IMG_5829.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5829.CR2
Downloading 'IMG_5830.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5830.CR2
Downloading 'IMG_5831.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5831.CR2
Downloading 'IMG_5832.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5832.CR2
Downloading 'IMG_5833.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5833.CR2
Downloading 'IMG_5834.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5834.CR2
Downloading 'IMG_5835.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5835.CR2
Downloading 'IMG_5836.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5836.CR2
Downloading 'IMG_5837.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5837.CR2
Downloading 'IMG_5838.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5838.CR2
Downloading 'IMG_5839.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5839.CR2


Now, lets say I have a few files on my SD Card, lets list them here:

  gphoto2 --list-files
There is no file in folder '/'.
There is no file in folder '/store_00020001'.
There is no file in folder '/store_00020001/DCIM'.
There are 5 files in folder '/store_00020001/DCIM/100CANON'.
#1     IMG_5840.CR2               rd 29955 KB image/x-canon-cr2
#2     IMG_5841.CR2               rd 29998 KB image/x-canon-cr2
#3     IMG_5842.CR2               rd 29907 KB image/x-canon-cr2
#4     IMG_5843.CR2               rd 30151 KB image/x-canon-cr2
#5     IMG_5844.CR2               rd 30089 KB image/x-canon-cr2
There is no file in folder '/store_00020001/MISC'.


So I have 5 files, now I can back them up (I am in a folder on the Raspberry Pi called /home/pi/dcim)

  gphoto2 --get-all-files
total 150116
drwxr-xr-x  2 pi pi     4096 Jun 25 11:05 .
drwxr-xr-x 17 pi pi     4096 Jun 25 11:03 ..
-rw-r--r--  1 pi pi 30673501 Jun 25  2017 IMG_5840.CR2
-rw-r--r--  1 pi pi 30717301 Jun 25  2017 IMG_5841.CR2
-rw-r--r--  1 pi pi 30624254 Jun 25  2017 IMG_5842.CR2
-rw-r--r--  1 pi pi 30873867 Jun 25  2017 IMG_5843.CR2
-rw-r--r--  1 pi pi 30810295 Jun 25  2017 IMG_5844.CR2


If I take some more photos (another five in this example) and I want to back them up, to stop gphoto2 downloading the original five files again, we can use another switch.

   gphoto2 --get-all-files --skip-existing
Skip existing file IMG_5840.CR2
Skip existing file IMG_5841.CR2
Skip existing file IMG_5842.CR2
Skip existing file IMG_5843.CR2
Skip existing file IMG_5844.CR2
Downloading 'IMG_5845.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5845.CR2
Downloading 'IMG_5846.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5846.CR2
Downloading 'IMG_5847.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5847.CR2
Downloading 'IMG_5848.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5848.CR2
Downloading 'IMG_5849.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_5849.CR2


So here we can see that by using <color #22b14c>gphoto2 –get-all-files</color> –skip-existing we skipped the first five files that we already had, and only downloaded the five new images.

copy_all_files_from_sd_card.txt · Last modified: 2023/03/09 22:35 by 127.0.0.1