Results 1 to 3 of 3

Thread: zmmailbox and spaces in folder names

  1. #1
    badrian's Avatar
    badrian is offline Starter Member
    Join Date
    May 2007
    Location
    Vancouver, Canada
    Posts
    2
    Rep Power
    7

    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.

  2. #2
    Bevan Bennett is offline Active Member
    Join Date
    May 2007
    Location
    Los Angeles, CA
    Posts
    31
    Rep Power
    7

    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"

  3. #3
    badrian's Avatar
    badrian is offline Starter Member
    Join Date
    May 2007
    Location
    Vancouver, Canada
    Posts
    2
    Rep Power
    7

    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!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •