>if your folder is a primary directly under $MAILPATH/ it works fine, as a >pure numeric > >so folder +2021 is fine -and I do this for archives by year. > >if your folder is sub-folder under another folder like +sent/2021 it only >kind-of works. Any function which performs scan functions looks to pure >numeric objects as files, and barfs on the directory. So I work around it >by having archives like sent/y2021 and it works fine.
The exact case is that there isn't a problem as long as something that is a folder doesn't contain a non-file who's name consists of all decimal digits. So in theory 'scan +$MAILPATH' probably won't work so well (but maybe that's not that useful in practice). >the other path out here is to do folder +2021/sent and subfolder sent >inside the archive year which works fine. > >I just wondered if a stat() on the object to skip (sub)folders in contexts >which demand files would work? Might be a pain to implement without >unwanted side-effects. This comes up occasionaly, most recently here: https://lists.nongnu.org/archive/html/nmh-workers/2023-03/msg00000.html Unfortunately, there are no good answers. stat()ing every possible message would be very expensive. dirent->d_type is not always reliable (and it's not easy to figure out when it will be reliable). The consensus in the past has been "don't do that". I am open to suggestions of course. --Ken
