Skip to content

Instantly share code, notes, and snippets.

@kimonostereo
Last active July 7, 2020 16:45
Show Gist options
  • Save kimonostereo/9900273c635a715fc731c3ddded59a34 to your computer and use it in GitHub Desktop.
Save kimonostereo/9900273c635a715fc731c3ddded59a34 to your computer and use it in GitHub Desktop.
Applescript for Panic's Transmit to sync a remote directory to a local directory with the option set to delete orphaned items. Modified from original script found here: http://www.mindthegapp.com/?p=4193
tell application "Transmit"
with timeout of (240 * 60) seconds
activate
tell application "Transmit"
-- Prevent interactive alerts from popping up during script execution
set SuppressAppleScriptAlerts to true
-- Set some variables to values to be used later in the script
set myFTPServer to item 1 of (favorites whose name is "YourFavoriteHere")
set pathToMainBackupDirectory to "/Volumes/Backups/Daily Backups/Tuesday"
set listOfSites to {""}
-- Start working with Transmit
-- Loop through the list of sites, change the remote and local browser path and sync
-- the remote site to the local site
repeat with a from 1 to length of listOfSites
set theCurrentSiteListItem to item a of listOfSites
tell current tab of (make new document at end)
-- Connect to the FTP Server
connect to myFTPServer
-- Change the path for the remote browser to correct path on the FTP server
change location of remote browser to path theCurrentSiteListItem
-- Change the path for the local browser to location of the backup
change location of local browser to path "/Volumes/Backups/Daily Backups/Tuesday" & theCurrentSiteListItem as string
-- Tell Transmit 5 to sychronize the remote location to the local location and delete orphans and follow symlinks
synchronize remote browser to local browser with delete orphaned items and follow symlinks
-- Close the remote browser window
close remote browser
end tell
end repeat
set SuppressAppleScriptAlerts to false
end tell
end timeout
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment