Skip to content

Instantly share code, notes, and snippets.

@nrollr
Last active December 24, 2015 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrollr/7edd972fd76c9a913789 to your computer and use it in GitHub Desktop.
Save nrollr/7edd972fd76c9a913789 to your computer and use it in GitHub Desktop.
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