In a past post, I included this script.
tell application id "com.apple.Finder" to duplicate file POSIX file ¬
"/Users/homer/Library/Thunderbird/Profiles/7jyt1da7.default-release/abook.sqlite" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/Address Book Sync" with replacing
tell application id "com.apple.Finder" to duplicate file POSIX file ¬
"/Users/homer/Library/Thunderbird/Profiles/7jyt1da7.default-release/history.sqlite" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/Address Book Sync" with replacing
tell application id "com.apple.Finder" to duplicate file POSIX file ¬
"/Users/homer/Library/Application Support/Firefox/Profiles/jla842kt.default-release/bookmarks.html" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/Firefox Bookmarks Sync" with replacing
tell application id "com.apple.Finder" to duplicate file POSIX file ¬
"/Users/homer/Library/Application Support/Firefox/Profiles/jla842kt.default-release/favicons.sqlite" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/Firefox Bookmarks Sync" with replacing
tell application id "com.apple.Finder" to duplicate file POSIX file ¬
"/Users/homer/Library/Application Support/Firefox/Profiles/jla842kt.default-release/places.sqlite" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/Firefox Bookmarks Sync" with replacing
tell application id "com.apple.Finder" to duplicate folder POSIX file ¬
"/Users/homer/Library/Application Support/ChronoSync/Tasks" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/Backup Scripts/ChronoSync Tasks" with replacing
tell application id "com.apple.Finder" to duplicate folder POSIX file ¬
"/Users/homer/Library/Application Support/XMenu/Custom" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/XMenu Sync" with replacing
tell application id "com.apple.Finder" to duplicate folder POSIX file ¬
"/Users/homer/Library/Application Support/SpamSieve" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/SpamSieve Backup" with replacing
tell application id "com.apple.Finder" to duplicate file POSIX file ¬
"/Users/homer/Library/Preferences/com.c-command.SpamSieve.plist" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/SpamSieve Backup/Preference File" with replacing
tell application id "com.apple.Finder" to duplicate file POSIX file ¬
"/Users/homer/Library/Application Scripts/com.apple.mail/Apple Mail - Remote Training.scpt" to the folder ¬
POSIX file "/Users/homer/Documents/MacBook Pro Specific/SpamSieve Backup/AppleScript" with replacing
display notification "Completed Successfully!" with title "Pre Backup AppleScript"
delay 1
Then Robert Fern posted this, saying he had cleaned up my script by consolidating it into 1 tell block.
tell application id "com.apple.Finder"
duplicate POSIX file ¬
"/Users/homer/Library/Thunderbird/Profiles/7jyt1da7.default-release/abook.sqlite" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/Address Book Sync" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Thunderbird/Profiles/7jyt1da7.default-release/history.sqlite" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/Address Book Sync" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Application Support/Firefox/Profiles/jla842kt.default-release/bookmarks.html" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/Firefox Bookmarks Sync" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Application Support/Firefox/Profiles/jla842kt.default-release/favicons.sqlite" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/Firefox Bookmarks Sync" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Application Support/Firefox/Profiles/jla842kt.default-release/places.sqlite" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/Firefox Bookmarks Sync" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Application Support/ChronoSync/Tasks" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/Backup Scripts/ChronoSync Tasks" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Application Support/XMenu/Custom" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/XMenu Sync" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Application Support/SpamSieve" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/SpamSieve Backup" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Preferences/com.c-command.SpamSieve.plist" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/SpamSieve Backup/Preference File" with replacing
duplicate POSIX file ¬
"/Users/homer/Library/Application Scripts/com.apple.mail/Apple Mail - Remote Training.scpt" to the POSIX file "/Users/homer/Documents/MacBook Pro Specific/SpamSieve Backup/AppleScript" with replacing
end tell
display notification "Completed Successfully!" with title "Pre Backup AppleScript"
delay 1
So here’s my question. Can you also consolidate “try” scripts (see below script)?
tell application "Finder"
try
set theFolderAlias to alias "Volumes:MacBook Pro Local Backups:Sync Folders Local Backups:Local Documents Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
try
set theFolderAlias to alias "Volumes:MacBook Pro Local Backups:Sync Folders Local Backups:Local Dropbox Folders Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
try
set theFolderAlias to alias "Volumes:MacBook Pro Local Backups:Sync Folders Local Backups:Local Installs Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
try
set theFolderAlias to alias "Volumes:MacBook Pro Local Backups:Sync Folders Local Backups:Local Movies Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
try
set theFolderAlias to alias "Volumes:MacBook Pro Local Backups:Sync Folders Local Backups:Local Music Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
try
set theFolderAlias to alias "Volumes:MacBook Pro Local Backups:Sync Folders Local Backups:Local Photos Archive Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
try
set theFolderAlias to alias "Volumes:MacBook Pro Local Backups:Sync Folders Local Backups:Local Pictures Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
end tell
delay 3
tell application "Finder"
empty trash
end tell