Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-26-2007, 06:21 PM
Starter Member
 
Posts: 2
Default zmmailbox and spaces in folder names

Running ZCS Open Source Edition, v4.5

I'm working on a (BASH shell) script to iterate through a user's mailbox folder tree, and am running into a problem with folders containing spaces in the name. My syntax is as follows:

Code:
#zmmailbox -z -m $ACCOUNT search -l 10 "in:$cof"
Where "$ACCOUNT" is the user mailbox, and "$cof" is the variable containing the folder name

The command works fine with folder names containing no spaces, but when the variable contains a space zmmailbox treats the space as the end of the value. As an example, in the case of the variable "$cof" expanding to "/Classroom/session 1":

Code:
#zmmailbox -z -m user@domain search "in:/Classroom/session 1"

The result returned is:

#ERROR: mail.NO_SUCH_FOLDER (no such folder path: /Classroom/session)
I've tried the standard UNIX/Linux trick of using a backslash preceding spaces, and have tried all manner of quotes around the folder names. Am I missing something really simple here?... any assistance with this would be greatly appreciated.
Reply With Quote
  #2 (permalink)  
Old 06-27-2007, 01:29 PM
Active Member
 
Posts: 31
Default

Interesting. Backslash escaping the spaces, or using either single or double quotes works for -other- zmmailbox commands (like gfg), but not for search, it appears.

[zimbra@nepenthes ~]$ zmmailbox -z -m bevan gfg /Schooner Room
usage:

getFolderGrant(gfg) [opts] {folder-path}
-v/--verbose verbose output

[zimbra@nepenthes ~]$ zmmailbox -z -m bevan gfg /Schooner\ Room
Inherit Permissions Type Display
------- ----------- ------ -------
[zimbra@nepenthes ~]$ zmmailbox -z -m bevan gfg '/Schooner Room'
Inherit Permissions Type Display
------- ----------- ------ -------
[zimbra@nepenthes ~]$ zmmailbox -z -m bevan gfg "/Schooner Room"
Inherit Permissions Type Display
------- ----------- ------ -------
[zimbra@nepenthes ~]$ zmmailbox -z -m bevan gfg '/Schooner\ Room'
ERROR: zclient.CLIENT_ERROR (unknown folder: /Schooner\ Room)

A little fiddling says that the follwing may actually work (I'd need confirmation, since I currently don't have any data in these folders to search for...)

zmmailbox -z -m USER search 'in:"/A Folder" 1'

Oddly, the following definitely does not work:

zmmailbox -z -m USER search "in:'/A Folder' 1"
Reply With Quote
  #3 (permalink)  
Old 06-28-2007, 11:26 AM
Starter Member
 
Posts: 2
Default

Bevan:

Your suggestion of this syntax seems to be just the thing:
Code:
zmmailbox -z -m USER search 'in:"/A Folder" 1'
Preliminary testing suggests it works perfectly -- I've got a script which will be making use of this, so I will have an opportunity to fully test it shortly.

Thanks for the assistance!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.