是否可以使用LIST
或LSUB
命令仅检索顶级文件夹?
假设我有以下文件夹(C表示客户端,S表示服务器):
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
我可以使用引用参数检索特定文件夹的子文件夹,如下所示:
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
然而,我想要做的是只能返回顶级文件夹的东西,这样我就可以按需检索特定的子文件夹,如下所示:
C: 0009 ???
S: * LIST (\HasNoChildren) "." "INBOX"
S: * LIST (\HasNoChildren) "." "Trash"
S: * LIST (\HasNoChildren) "." "Sent"
S: * LIST (\HasNoChildren) "." "a"
S: 0009 OK LIST completed
这可能吗,如果可以,它是如何完成的?
答案 0 :(得分:2)
LIST "" "%"
%是一个不应该遍历层次结构的通配符。