Question

Is it possible to retrieve only the top-level folders using a LIST or LSUB command?

Let's say I have the following folders (C denotes Client, S denotes Server):

C: 0007 LIST "" "*"
S: * LIST (\HasNoChildren) "." "INBOX"
S: * LIST (\HasNoChildren) "." "Trash"
S: * LIST (\HasNoChildren) "." "Sent"
S: * LIST (\HasChildren) "." "a"
S: * LIST (\HasChildren) "." "a.b"
S: * LIST (\HasNoChildren) "." "a.b.c"
S: * LIST (\HasNoChildren) "." "a.d"
S: 0007 OK LIST completed

I can retrieve subfolders of a specific folder by using the reference argument, like so:

C: 0008 LIST "a" "*"
S: * LIST (\HasChildren) "." "a"
S: * LIST (\HasChildren) "." "a.b"
S: * LIST (\HasNoChildren) "." "a.b.c"
S: * LIST (\HasNoChildren) "." "a.d"
S: 0008 OK LIST completed

However what I'd like to do is something that can return just the top-level folders, so that I can then retrieve the specific subfolders on demand, like this:

C: 0009 ???
S: * LIST (\HasNoChildren) "." "INBOX"
S: * LIST (\HasNoChildren) "." "Trash"
S: * LIST (\HasNoChildren) "." "Sent"
S: * LIST (\HasNoChildren) "." "a"
S: 0009 OK LIST completed

Is this possible to do, and if so, how is it done?

Was it helpful?

Solution

LIST "" "%"

% is a wildcard that is not supposed to traverse heirarchies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top