property cccDisk : ""
set theStart to true
try
set p to 1
tell application "Finder"
activate
set my cccDisk to "Daily Backup"
set theExternalDisk to disk (my cccDisk)
set folderNames to name of (folders of (folder "Users" of theExternalDisk))
repeat with eachname in folderNames
if eachname is not in {"Guest", "Shared"} then
set theExternalUser to folder eachname of (folder "Users" of theExternalDisk)
exit repeat
end if
end repeat
set theMailStorage to every folder of folder "V4" of folder "Mail" of folder "Library" of theExternalUser
set repeatExit to true
repeat with eachCheckFolder in theMailStorage
set p to 2
set eachCycleFolder to every folder of eachCheckFolder
repeat with eachFolder in eachCycleFolder
set p to 3
if (name of eachFolder as text) starts with "Year" and name extension of eachFolder is "mbox" then
set p to 4
set eachFolder to eachFolder as alias
set p to 5
tell application "System Events" to display dialog (eachFolder as text) giving up after 2
set p to 7
my importMail(eachFolder)
end if
end repeat
end repeat
end tell
on error errmsg
tell application "System Events" to display dialog errmsg & " p = " & p giving up after 20
end try
on importMail(eachFolder)
tell application "Mail"
activate
try
say "importing"
import Mail mailbox at eachFolder
on error errmsg
tell application "System Events" to display dialog "Import " & errmsg giving up after 20
end try
end tell
end importMail