Sorting of folders
Chris Green
cl at isbd.net
Thu Jun 24 20:02:37 UTC 2021
On Thu, Jun 24, 2021 at 02:54:29PM -0400, Jon LaBadie wrote:
> On Thu, Jun 24, 2021 at 11:06:25AM +0100, Chris Green wrote:
> > Is there any way that one can overcome this major disadvantage of
> > maildir?
> >
> > Since maildir messages are saved in sub-directories of the named
> > 'maildir directory' there seems to be no practical way to do sorting
> > of maildirs on anything but name.
> >
> > What I'd really like to be able to do is to sort on date of last
> > message.
> >
> > For example I have a 'shopping/diy' directory which has lots of
> > sub-directories like 'glue', 'grease', 'lynchpins', etc. It would be
> > really handy if I could sort the directories within 'diy' by date as
> > then the most used ones (or the most recently used ones) would be at
> > the top of the listing and quicker to get to. However, as far as I
> > understand things, this isn't possible with maildir as the date on the
> > *directory* (e.g. the date on 'glue' or 'lynchpin') is the date of
> > creation of the directory which might be years ago when I first bought
> > some glue.
> >
> > If these were mbox mailboxes then they'd be a file whose date would
> > reflect the last entry which would be exactly what I want.
> >
>
> The date you see with an "ls -l" is called "mtime", time of last
> modification of the entries data. If it happens to match your
> directories time of creation (which is not stored) it is coincidence.
>
> For a directory, its data is the list of files it contains. So mtime
> should change whenever an entry is added or removed. Note, renaming
> and entry is typically add an entry, the new name as a link, then
> unlink the old name.
>
> Try sorting the directories according to mtime with ls -lt (or -ltr
> for reverse order).
>
You've missed the point (I think), in a maildir the directories whose
mtime dates change are the cur, new and tmp directories. The parent
directory whose name is the mailbox name never changes mtime (unless
you do something other than adding or removing messages). The maildir
directory doesn't contain any files that change, only cur, new and tmp
directories.
--
Chris Green
More information about the Mutt-users
mailing list