Hello This is the "expected" but, I agree, counter-intuitive result. First notmuch finds all the *messages* that match your query (ie which have an associated filename matching the folder: part of your query) and then it returns all filenames for these messages. I think that notmuch views a message (as determined by a message-id) as a single object in its database (it assumes that all copies are identical) so fixing this would not be easy. Best wishes Mark Nathan Clapham <nathan@claphams.info> writes: > Hi Everyone, > > Thanks for notmuch mail, it is a great program! > > I am having an issue searching with --output=files and the folder prefix. > > Could you please tell me if I've misunderstood something or perhaps there is > something wrong with my setup. Details of 2 examples below: > > $ notmuch --version > notmuch 0.15.2 > > ---- > 1. Archive folder > > Archive message #: 1356 > Directory: $HOME/Mail/Gmail/[Gmail].Archive > > $ notmuch count folder:Archive > 1356 > > $ notmuch search --output=messages folder:Archive | wc -l > 1356 > > $ notmuch search --output=files folder:Archive | wc -l > 1572 > > I wondered why I was getting more files listed in the last example. It turns out > some files are included from other folders. For example: > > Mail/Gmail/[Gmail].Sent Mail/cur/137075610...28e65ad90fc4f:2,S > > If I then do this: > > $ notmuch search --output=files folder:Archive | grep Archive | wc -l > 1356 > > I get the correct count again. > > Different folders have a similar issue: > > 2. INBOX folder > > INBOX message #: 87 > Directory: $HOME/Mail/Gmail/INBOX > > $ notmuch count folder:INBOX > 87 > > $ notmuch search --output=messages folder:INBOX | wc -l > 87 > > $ notmuch search --output=files folder:INBOX | wc -l > 97 > > This time some messages from Archive are included: > > Mail/Gmail/[Gmail].Archive/cur/137077654...d7c877e152f72dd5ddbc11f:2,S > > $ notmuch search --output=files folder:INBOX | grep INBOX | wc -l > 87 > ---- > > I think this illustrates the problem I'm having. Maybe I don't understand how > the folder: prefix works? Perhaps it is my folder structure - the inclusion of > the imap prefix [Gmail].?? It seems the search is matching the correct messages > though, but the output of files includes messages from another folder. > > Any advice would be appreciated. > > Thanks, > Nathan. > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch