[Samba] Samba Files Sorting

Jeremy Allison jra at samba.org
Thu Apr 30 02:07:01 UTC 2020


On Thu, Apr 30, 2020 at 09:37:50AM +0800, Yao Hong Qi via samba wrote:
>  I want to auto sorting by date for share folder files.  Because like VLC player when I using it via samba share to play video, there is no sorting files option and I have to manually search.Such as minidlna there is "force_sort_criteria=" options.
> I wonder whether samba also have this option?

We have a vfs_dirsort module that sorts alphabetically,
but it would be hard to sort by date as the underlying
POSIX interface that gets directory entries, readdir()
only returns the name and not the meta-data such as
timestamps.

You'd have to make a new module based on dirsort
that does a stat after we get the name from readdir
and then uses that meta data as input to the qsort
compare function.



More information about the samba mailing list