I've added support for downloading and deleting images. I haven't tested this very thoroughly, so bugs are likely.
Dowloading is done with mc:download_images(), which takes an table of options.
Specifying the destination:
The destination is specified with the dst option. You can use substitution variables, specified like ${foo} to control the path for each iamge.
The default is
dst='${id}/${subdir}/${name}'
which means: The ID number of the camera, the DCIM subdirectory (e.g 100CANON) and the camera filename (e.g IMG_0123.JPG)
Available substitutions are
${id,strfmt} camera ID, default format %02d
${serial,strfmt} camera ID, default format %s
${ldate,datefmt} PC clock date when download was started, os.date format, default %Y%m%d_%H%M%S
${lts,strfmt} PC clock date as unix timestamp + microseconds when download was started, default format %f
${mdate,datefmt} Camera file modified date, converted to PC time, os.date format, default %Y%m%d_%H%M%S
${mts,strfmt} Camera file modified date, as unix timestamp converted to PC time, default format %d
${name} Image full name, like IMG_1234.JPG
${basename} Image name without extension, like IMG_1234
${ext} Image extension, like .JPG
${subdir} Image DCIM subdirectory, like 100CANON or 100___01 or 100_0101
${imgnum} Image number, like 1234
${dirnum} Image directory number, like 101
${dirmonth} Image DCIM subdirectory month, like 01, date folder naming cameras only
${dirday} Image DCIM subdirectory day, like 01, date folder naming cameras only
the format arguments are all optional
General options:
pretend=bool -- doesn't actually download or delete, just print
delete=bool -- delete files after downloading. Use with caution
overwrite=bool -- overwrite existing files with the same name
verbose=bool -- print what it's doing. Implied with pretend
File options:
By default, it will download files matching the normal image name pattern (ccc_nnnn.ext) from all subdirectories of DCIM. You can pass start_dirs={'A/DCIM/101CANON'...} if you want, but unless your camera numbering is exactly in sync, this won't be very useful.
You can use fmatch to match certain files. For example fmatch='%.DNG$' will only download DNG files. The default fmatch is '%a%a%a_%d%d%d%d%.%w%w%w'
Other find_files options are also available, but may or may not make sense.
examples:
list all the image files on all the cameras, without actually downloading
!mc:download_images({pretend=true})
download DNG files to test/<camera name>, overwriting, delete when done
!mc:download_images({verbose=true,delete=true,overwrite=true,dst="test/${name}",fmatch='DNG$'})
You can also use mc:imglist() to get a list of images in lua. This returns table indexed by ID. Each ID points to an array of file information, which includes the path and stat information.
Note that IDs are not necessarily contiguous, so you shouldn't use ipairs to iterate over the outer table. The inner table is a proper array.