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

Adam Chasen via Gphoto-devel <[email protected]> Fri, 19 May 2023 11:09:09 -0400
Newsgroups gmane.comp.multimedia.gphoto.devel
Message-ID <[email protected]>
Great news! I see the FLAGS_REVERSE in my checkout, but no recent commits. Is https://github.com/gphoto/gphoto2 the location of your branch?

Thanks,
Adam

On Fri, May 19, 2023, at 05:17, Marcus Meissner wrote:
> 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