https://github.com/renderghost/macos-folder-sync
Automatically sync folders on MacOS
https://github.com/renderghost/macos-folder-sync
applescript file-syncing macos
Last synced: about 1 year ago
JSON representation
Automatically sync folders on MacOS
- Host: GitHub
- URL: https://github.com/renderghost/macos-folder-sync
- Owner: renderghost
- License: mit
- Created: 2023-10-11T19:58:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-12T15:09:33.000Z (over 2 years ago)
- Last Synced: 2025-01-25T16:42:18.538Z (about 1 year ago)
- Topics: applescript, file-syncing, macos
- Language: AppleScript
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# macOS Folder Sync Automation
> Automatically sync folders on MacOS
## Overview
This repository contains an AppleScript for automating folder synchronization between between folders on macOS.
The script ensures that the folders are kept in sync every time the external drive is connected.
## Features
- Copies new files from the source folder to the destination folder
- Skips files that already exist in the destination folder
- Deletes files in the destination folder that no longer exist in the source folder
## Requirements
- macOS
- AppleScript
- launchd (for automation)
## Setup
### Define the Paths
Edit the `SyncMyFiles.applescript` file to specify the paths of your source and destination folders.
```applescript
-- Define source folder on the internal drive
set sourceFolder to "/source"
-- Define destination folder on the external drive
set destinationFolder to "/destination"
```
### Compile the Script
Compile the modified AppleScript as an `SyncMyFiles.scpt` file on your Mac.
### Sync the `.plist` file for `launchd`
Copy the `SyncMyFiles.plist` file to `~/Library/LaunchAgents/` to automate the script execution when the external drive is connected.
```bash
cp ~/code/macos-folder-sync/SyncMyFiles.plist ~/Library/LaunchAgents/
```
Run the following command in Terminal to load the `SyncMyFiles.plist` file:
```bash
launchctl load ~/Library/LaunchAgents/SyncMyFiles.plist
```
## Usage
### Automated
1. Connect your external drive.
2. The script should run automatically, syncing the specified folders.
3. That's it.
### Manual
```bash
osascript ~/code/macos-folder-sync/SyncMyFiles.scpt
```
## To Do
- [ ] Confirm start on-run
## License
MIT