Mail.app: Create\Manage the Folder Hierarchy based on the Current Date


tell (current date)
	set {monthString, yearString} to {its month as text, year as text}
	set tt to "" & day & " " & monthString & " " & yearString
end tell

tell application "Mail"
	if not (exists mailbox yearString) then
		make new mailbox with properties {name:yearString}
		say 1
	end if
	if not (exists mailbox monthString of mailbox yearString) then
		make new mailbox with properties {name:yearString & "/" & monthString}
		say 2
	end if
	if not (exists mailbox tt of mailbox monthString of mailbox yearString) then
		make new mailbox with properties {name:yearString & "/" & monthString & "/" & tt}
		say 3
	end if
end tell