Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Applescript to backup Thunderbird directory as .zip File
-- Copy Thunderbird directory to /Users/{username}/Temp/
set mailFolder to ((path to home folder) as text) & "Library:Thunderbird" as alias
set tempFolder to ((path to home folder) as text) & "Temp" as alias
tell application "Finder"
duplicate folder mailFolder to folder tempFolder with replacing
end tell
-- Compress the Thunderbird copy
set destinationFolder to ((path to home folder) as text) & "Temp" as alias
set sourceFolder to ((path to home folder) as text) & "Temp:Thunderbird" as alias
set dateStamp to short date string of (get current date)
set zipFile to (POSIX path of (destinationFolder) & "Mail_" & dateStamp & ".zip")
set zipFolder to (POSIX path of (sourceFolder))
tell current application
do shell script "zip -r " & zipFile & " " & zipFolder & ""
end tell
-- Remove the Thunderbird copy
tell application "Finder"
delete folder sourceFolder
end tell
display notification "Thunderbird: backup successful!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment