Search notes:

Shell command: gphoto2

Showing available storages

$ gphoto2 --storage-info
$ gphoto2 --storage-info | grep basedir

Listing directories in a given folder

The following command lists the subfolders in a given folder (for example /store_00010001/DCIM). The -f flag specifies the folder, the -l flag specifies to list the sub folders:
$ gphoto2 -f /store_00010001/DCIM -l
In order to turn off the recursive listing, the --no-recurse flag can be applied.
One might try to list the folders the root folder / in order to start down- or uploading files.

Listing files in a given folder

This is almost the same as above, but with -L instead of -l.
$ gphoto2 -f /store_00010001/DCIM/106___10 -L
The listing prints an image's number and its name on a line. The numbers can be used to download a range of images.

Downloading a specific file

Downloading a specific file by its filename doesn't seem to be possible. The --filename names the files that are downloaded, not the files to be downloaded.
gphoto2  -f /store_00010001/DCIM/106___10 -p 42 --filename my-favorite.jpg

Getting all files from a given folder

The -P flag specifies that all files from a given folder are copied to the current working directory.
gphoto2 will ask if a file should be overwritten, if a file name is already present.
$ gphoto2 -f /store_00010001/DCIM/106___10 -P

Getting a range of pictures

The -p flag also allows to specify a range of images to download. The following command downloads images numbered 1490 through 1995.
$ gphoto2 -f /store_00010001/DCIM/106___10 -p 1490-1995
The image numbers can be found out by using the -L flag.

Using the --new flag

Apparently, -P (to get all files from a folder) can be combined with the --new flag so that only files will be retrieved that are not already downloaded.

Putting a file to the device

The -u flag specifies the file which should be uploaded to the device:
$ gphoto2 -f /store_00010001/Movies -u foo.mp4

Deleting a file

A file to be deleted can be named with the -d flag:
$ gphoto2 -f /store_00010001/Movies -d foo.mp4

See also

Shell commands

Index