property MatchYearString : "Year 2012"
property NewYearString : "Year 2013"
tell application "Mail"
set theBoxes to mailboxes
set boxesReversed to reverse of theBoxes
repeat with eachBox in boxesReversed
if name of eachBox is MatchYearString then
try
set theBoxParent to container of eachBox
say "Container mailbox is " & name of theBoxParent
if not (exists mailbox NewYearString of theBoxParent) then
make new mailbox with properties {name:name of theBoxParent & "/" & NewYearString}
say "New mailbox, " & NewYearString & "created."
end if
end try
end if
end repeat
end tell
On 21/12/2011, at 3:41 PM, Robert Nicholson wrote:
Are there any examples of traversing the Mailboxes top down instead of bottom up?
ie.
you have mailboxes at any level 2011.mbox and you want to create a 2012.mbox under the same parent folder.
How is that best done in Applescript? _______________________________________________