Wednesday, October 17, 2018

#1 2018-10-09 05:06:17 am

ldicroce
Member
Registered: 2017-11-25
Posts: 64

Export mailboxes with including subfolders

dear all,

I am looking for a script to export all mailboxes in my "iCloud" account, some of them have subfolder and thus I would like to have the option to select the "Export all subfolder" (rather than exporting each subfolder ...).

I looked in the archives, but I didn't find anything. And in the Mail dictionary I could not even find the command "export" ...

Any suggestion?

Thanks

L.

Last edited by ldicroce (2018-10-09 05:15:28 am)

Offline

 

#2 2018-10-09 08:38:09 am

ldicroce
Member
Registered: 2017-11-25
Posts: 64

Re: Export mailboxes with including subfolders

This is what I have done so far ....

Applescript:

set FilterFoldersOut to {"Archive", "Apple Mail To Do", "Notes", "INBOX", "Drafts", "Sent Messages", "Deleted Messages", "Junk"} -- I dont need those mailboxes
set TopLevelMailboxes to {}

tell application "Mail"
   set allMailboxes to every mailbox of account "iCloud"
   repeat with aMailboxes in allMailboxes
       set myName to (name of aMailboxes's container) as rich text
       if name of aMailboxes's container = missing value then -- it means that it is a top level folder, it might or might not have subfolder(s), but for sure IT IS NOT a subfolder
           if name of aMailboxes is not in FilterFoldersOut then --remove those folders I dont need
               set theM to mailbox (name of aMailboxes) of account "iCloud" -- I can select the folder in case I can trigger the "Export" command by UI...
               set end of TopLevelMailboxes to (name of aMailboxes)
           end if
       end if
   end repeat
end tell

I have now a list of folders I want to export. Some of them have subfolders, and for those I would like to have the "Export all subfolder"  option activated.

Any suggestion on how to continue?

Thanks

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)