AppleScript to move mail to sub-sub-folders?

I need help for an Applescript script.

When I upgraded my OS X, all of my mail archives went AWOL.  I had them on Time Machine, but they are deep down in the subfolders.  And there are many of them.  (Example below).

I'm putting messages out of the sub-sub-folders.

I tried to write an AppleScript, but it does nothing:

(where "-source" and "-target" are temporary test mailboxes.)

I think that it cannot be recursing into sub-sub-folders.

Can anyone help?

OS X El Capitan 10.11.3

view the iMac with the retina, 4 Ghz, 16 GB, 1 TB

Hello

Because each mailbox to a mailbox, return the mailboxes at the root of the source folder.

Examples:

each mailbox to mailbox 'import', return of mailbox "0drafts".

each mailbox to mailbox "0drafts", return of mailbox "B9FA3AB1-...". »

each 'data', return mailbox mailbox {mailbox, mailbox '8', '7' mailbox, mailbox '3' "9" ""}

The script need a recursive handler like this:

-------------------

Tell application "Mail".

the value in the mailbox mSource "-source.

mailbox value dest "-target".

tell the end

My getSubMailboxes_moveMSGs (mSource, dest)

on getSubMailboxes_moveMSGs (s, d)

Tell application "Mail".

move the messages from s to d

Repeat with thisSubMBox (get s mailboxes)

My getSubMailboxes_moveMSGs (thisSubMBox, d)

end repeat

tell the end

end getSubMailboxes_moveMSGs

------------------

Tags: Mac OS & System Software

Similar Questions

  • How can I copy files/sub-sub-sub-folders in Icloud on MacBook? Since the upgrade to Sierra, I see all of my folders in icloud but not on my Mac.  Thanks - David

    How can I copy files/sub-sub-sub-folders in Icloud on MacBook? Since the upgrade to Sierra, I see all of my folders (with documentation) in icloud but not on my Mac.  Thanks - David

    Turn off the power of optimized storage and copy the files to your Mac.

    1. Click on the Apple icon in the upper left corner of your screen.
    2. Select has about this Mac from the menu drop down.

    3. click on the tab for storage in the system information window.

    4. click on manage the...

    5 disable the storage element optimize.

  • How can I get the Photo screen saver to use sub folders?

    In XP, it would display all the photos on the hard drive, or if I chose "My pictures" he would use all the photos in this main folder, as well as all photos in sub folders. With Win7 I can't get to use the photos in a specific folder. IIRC, in XP, you can even select the files to include and exclude?

    My HD is partitioned and I use C: for OS and programs and D: for docs, FYI.

    It's working now. I have a click with the right button on the D: drive, wriggling on "Include in the library" and clicked on "Images". Not positive this is what fixed it, because I'm not sure how to UN - include it in the Library A - b test. But as long as it works...

  • Search for primary file + Sub-folders

    Okay, I know how to locate a specific file in a specified place; but now I need a way to locate a specific file in a general situation.  Basically I have a library of textures with their exact file name.  Well, I still don't know their exact location.  For example, I have to run through my script "brushed_aluminum.jpg" textures, but I don't know exactly where it is, I just know that it's somewhere in my file textures (c:\textures\ for the sake of simplicity).  Now, in c:\textures\ there are several subfolders (and possibly sub-sub-folders, etc.) it might be in.  How would I go to have the script to find the file in this location, then get his exact path and store the exact path + name of file to a variable?  Thanks for any help!

    dgolberg

    Edit: I had 2 other questions, but I was able to resolve myself.

    Adding the last example...

    function main(){
    var Path = File($.fileName).parent;
    var csvFile = File(Path + "/csvFile.csv");//csv file
    var errorLog = File(Path + "/errors.txt");//error log
    $.os.search(/windows/i)  != -1 ? errorLog.lineFeed = 'windows'  : errorLog.lineFeed = 'macintosh';
    if(!csvFile.exists){
        alert("Unable to find CSV file!");
        return;
        }
    var sourceFolder = Folder.selectDialog("Please select Folder where files are to be found");
    if(sourceFolder == null) return;
    var folders =[];
    folders = FindAllFolders(sourceFolder, folders); //get a list of all sub folders
    folders.unshift(sourceFolder);
    csvFile.open('r');
    var data=[];
    csvFile.readln(); //do not process the header line
    while(!csvFile.eof){
       var line = csvFile.readln().replace(/^\s+|\s+$/g, ''); //remove leading and trailing spaces
       if(line.length>3) data.push(line); //Make sure it's not a blank line
    }
    csvFile.close();
    for(var a in data){//process your files
    var bits = data[a].split(',');
    for(var z in folders){//loop through all folders to find file
        var file = File(folders[z] + "/"+bits[0]);
        if(file.exists) break;
        }
    if(!file.exists) {//if file not found it is logged in error file.
        errorLog.open('e');
        errorLog.seek(0,2);
        errorLog.writeln(bits[0] + " could not be found");
        errorLog.close();
        continue;
        }
        //open (file);
        //runaction
        //app.doAction(bits[1].toString(), bits[2].toString());
        //do whatever
        //save and close you document
        alert(file +"\r will be running action - " + bits[1].toString() + " actionSet = " + bits[2].toString() );
        }
    }
     function FindAllFolders( srcFolderStr, destArray) {
     var fileFolderArray = Folder( srcFolderStr ).getFiles();
     for ( var i = 0; i < fileFolderArray.length; i++ ) {
      var fileFoldObj = fileFolderArray[i];
      if ( fileFoldObj instanceof File ) {
      } else {
             destArray.push( Folder(fileFoldObj) );
      FindAllFolders( fileFoldObj.toString(), destArray );
      }
     }
     return destArray;
    };
    main();
    
  • Can not save attachments in Windows Mail in Vista Local folders or subfolders

    I have a new Vista 64 system and I have actually two problems.  First of all, I can't move old emails (more 2 G total) of my XP Outlook Express email on my old laptop in Vista 64 - bit Windows Mail on my new desktop.  Files folders and the content may be downloaded, but have not been recognized and installed by Win. Mail.  I talked to several computer technicians who could not find a solution except either to send the emails from old files individually or as a group to myself to my server (Yahoo more).  Is there a better solution?  Secondly, when I send my self a such email with multiple attachments and I try to save, I can't find a thread that will lead to my Windows Mail > local folders > Inbox >(folders and sub-folders).  Nor can I drag-and - drop these saved emails (they contain many different endings) to these files. Help, please.

    Hello Mmmaltby,

    Thank you for using Microsoft Vista answers Forum!

    A common method to transfer everything via is to use the Export command in Outlook Express to save all messages and contacts to separate files, copy them to the Vista PC and then use the option import (on the file menu) to import the data into Windows Mail.

    If please reply and let us know if your problem is resolved or if you need more help

    David O
    Microsoft Answers Support Engineer
    Visit our and tell us what you think.

  • How to move all messages in local folders?

    In my Thunderbird I have an IMAP account that is no longer existing on the remote mail server. All mail is on my local drive I can open it and browse. What I want is to move all messages in local folders and get rid of the old count IMAP. It's really annoying that it always tries to connect to the remote server all the time when I open and browse mail.

    How can I do? When I try to drag and drop a few messages, Thunderbird attempts to remove them from the remote server, which of course not as the remote account does not longer exist, and that is why nothing is moved. I also searched if there is an option to take into account in offline mode, but found nothing.

    Try it in "offline" mode
    Click on two screen blue icon in the lower left corner of the status bar to switch to offline mode which will show two black screen icon.

    If this does not work, try this addon to import e-mails in local folders.

    Right click on local folders > ImportExporttool > import a mbox file
    or
    in the local folders
    Create a folder of the same name
    Right-click on the created folder > ImportExporttool > import messages

  • How to move mail on my mac to my new iPad pro

    How to move mail from my new iPad pro macbook

    If this is the iCloud mail, you simply connect to iCloud on your iPad is that make sure that Mail is enabled in iCloud and voila, the mail comes. May need a little time to get there, though.

  • Move mail in the Outlook window

    I have Windows Mail and Outlook on my compurter. How to move mail from the Outlook window?

    I have Windows Mail and Outlook on my compurter. How to move mail from the Outlook window?

    What do you mean exactly "switch"?

    If you want Outlook as your default program...
    Start > default programs > set your default programs > column to the left, click Microsoft Outlook. Be sure to what he said "this program has all its flaws. > OK

    If your average 'export' e-mail messages from Windows Mail to Outlook, see this link:
    http://support.Microsoft.com/kb/196347 how to export e-mail messages from Windows mail to Outlook

    To export contacts from Windows Mail > open Windows Mail > file > export > Windows Contacts > CSV > Export
    To import contacts from WM to Outlook > open Outlook > file > Import/export > import from another program > next > select CSV > next > navigate to the folder that stores your CSV, click > OK

    t-4-2

  • How to create rules to move mail junk folder junk mail automatically using window 8 mail app?

    Original title: spam

    How to create rules to move mail junk folder junk mail automatically using window 8 mail app?

    I don't think that the Mail App in its current form has this feature.

  • Sub folders, I added using VIsta with Windows Mail, disappeared

    Subfolders that I added were to sort my important emails.  I tried to restore unscuccessfully.  Standard folders are like inbox, outbox, sent items, etc.

    If subfolders are not in the deleted items, or became the subfolders to another folder (look for it +), then you have problems.
     
    You can try to find them with this tool. Uncertain, but worth a try.
     

     
    Hindsight is 20-20, but look at my signature.
     
  • Cannot move mail to folders in the mail application.

    This is the error message I get:

    The IMAP command 'APPEND' (to [name of the mailbox]) failed with Server error: off-quota (failure).

    I get it when you try to move the mail to folders organized in the mail application. I use iCloud account and a gmail account. Anyone run into this? It just started out of the blue.

    Thanks in advance for your help.

    Data sheet:

    iMac 27 inch end 2012

    I7 to 3.4 GHz

    32 GB of ram

    NVIDIA GeForce 680mx

    El Capitan 10.11.3 OSX

    It is a message from the mail server. The mailbox is full.

  • Sub-Folders

    I created an empty folder in my favorites (my network places) and I'm putting the other folders inside so that they become subfolders. They do not seem to drag into the new folder. How can I get them all in a new folder that I made?

    In IE: In the Menu bar click Favorites | Organize Favorites. You can move the files there?
    Otherwise, ask a in Forum Internet Explorer
    http://answers.Microsoft.com/en-us/IE 
  • How can I move mail in the Inbox of offline folder to a local folder?

    I have an IMAP account and my supplier has lost everything except the last week of my emails. I still have in the folder offline in Thunderbird so as long as I stay in offline mode I can see the emails but I want to move them into local folders to be able to go online and synchronize the account without losing all the. How can I do this?

    https://addons.mozilla.org/en-US/thunderbird/addon/importexporttools/try using the import export tools to make backups of mail EML. then if it works, you can go online and allow synchronization. If your provider has simply lost the mail they can synchronize successfully. If this is not the case you can drag the EML files in IMAP folder (a little at a time) and they need to synchronize

  • mobile e-mail from the admin folders. page to a new page to the user.

    How can I move files mail of my admin page to a new page of the user, so that both users can access folders?

    Hello

    Who did you send provider?

    What is a mail on the Web, or you use any e-mail like outlook client?

    What do you mean by new user page? Referring to the new user account?

    If you are making reference to the new user account where you need access to these files and folders, you can try to move your folders in the Public folder.

    The Public folder is a convenient way to share files that are stored on your computer. You can share files in this folder with other people using the same computer and with people using other computers on the same network. Any file or folder you put in the folder Public is automatically shared with the people who have access to your Public folder.

    For more information about public folders, you can see the article below.

    Sharing files with the Public folder
    http://Windows.Microsoft.com/en-us/Windows-Vista/sharing-files-with-the-public-folder

    Let us know if this helps

    Concerning
    Anthony.

  • E-mail blackBerry Smartphones Syncronize folders

    The research I've done, it seems that I can add, move, delete or rename folders of e-mail on my BlackBerry smartphone only if I have the business version of the operating system. Is it possible to be able to organize my messages on my device other than a huge Inbox as a personal user (not business)?

    If possible I want to synchronize my files, but I'd settle for just being able to create my own files on my blackberry for organization purposes.

    It's maybe just me, but this seems to be a huge weakness when compared to other types of mobile devices.

    Assuming you are using outlook to synchronize

    How to synchronize a subfolder using BlackBerry Desktop Manager

Maybe you are looking for

  • How to 'forget' a password for a particular web site?

    Accidentally, I selected the option 'Remember password' on a computer where I don't want to remember the password I entered the computer. Is it possible to erase the password for that particular web site without deleting the other passwords?

  • My machine software XP does work on WIndows 7?

    Our Church is to get new machines. We have Quickbooks software and office XP.  Can I install XP on 7 and get updates online, or do we have to buy all new software? Thank you.

  • 5510 black cartridge does not print

    I have a printer 5510 I just changed the black cartridge in, but it will not print black. All the other colors, but not black. Have tried all the usual remedies (head, cleaning etc.) and the utility tools, but nothing seems to work. It is a genuine H

  • PIX501 - PDM - no taken in charge the found command

    Hello I use a PIX501 with 3.0 (4) PDM and PIX OS 6.3 (5) and I can not use PDM to make configurations. When a test open Configuration tab in PDM a message «unsupported command Found»

  • Popup error

    whenever I click on anything IN my adobe animate cc TI 2015; give me this popup- Capture - color-of-the-storm Sta.shI have to click around 20 times before he goes, and he keep doing this every time.I just got the subscription for the first time, and