Re: changing the "sort" order of "--get-all-files"

Marcus Meissner <[email protected]> Fri, 19 May 2023 11:17:33 +0200
Newsgroups gmane.comp.multimedia.gphoto.devel
Organization SUSE Software Solutions Ger many GmbH, Frankenstraße 146, 90461 Nuernberg, Ger many, GF: Ivo Totev, Andrew Myers, Andrew McDonald , Martje Boudien Moerman, HRB 36809, AG Nürnberg
Message-ID <[email protected]>
On Thu, May 18, 2023 at 02:51:00PM -0400, Adam Chasen via Gphoto-devel wrote:
> I would like to create a patch which would reverse the sort order of "--get-all-files" (with --skip existing). In the case of my Sony RX100M3, the files are organized by date and are sorted from oldest to newest. I would prefer newest files to be pulled down first. The speed of PTPIP on this camera is pretty bad taking several seconds for each directory listing. 
> 
> I found the functions in libgphoto2 which are responsible for listing the directories, but am struggling to trace the execution of gphoto CLI with "--get-all-files" to the sequence of "list all folders" (and skip if present). I believe it is similar to the "-l" call which starts with listing of the root and recursively lists all folders.
> 
> Any pointers on following the code from execution to downloading for a call with `--get-all-files`?
> 
> Aside, an option to stop syncing when we run in to a "date folder" where everything is "skipped" would be handy.
> 
> Another aside, the camera communication stability isn't great and often locks up before it even has a chance to list the 100 directories.

for_each_file_in_range is the function doing that.

Someone seems to have added a REVERSE flag there already, but not
configured it to be set anywhere.

I just added code to gphoto2 master  to add a --reverse option.

Can you try?

Ciao, Marcus