- Notifications
You must be signed in to change notification settings - Fork0
📁 Watch-Sync: Real-time file synchronization tool that watches for changes and instantly syncs via FTP, SFTP, and rsync. Perfect for web developers maintaining remote servers, with smart directory structure preservation and flexible configuration options. ⚡ Simplify your workflow!
License
erkineren/watch-sync
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Go console application that watches directories for changes and synchronizes them using various protocols (FTP, SFTP, Rsync).
- File System Watching: Monitors a directory for file/folder creation, modification, and deletion
- Recursive Watching: Detects changes in subdirectories
- Multiple Sync Methods:
- FTP upload
- SFTP upload
- Rsync synchronization (preserves directory structure)
- Configurable: Uses JSON configuration file stored in the user's home directory
- Graceful Shutdown: Properly cleans up resources on exit
- Ignores CHMOD Events: Avoids unnecessary syncs for permission changes
# Clone the repositorygit clone https://github.com/erkineren/watch-sync.gitcd watch-sync# Build and installmake install
Download the latest binary from thereleases page.
# Watch the current directory with no actionswatch-sync# Watch a specific directorywatch-sync -path /path/to/watch# Watch with specific actions to triggerwatch-sync -actions prod-ftp,staging-sftp# Watch a specific path with specific actionswatch-sync -path /path/to/watch -actions backup-rsync# Watch without recursion (top level only)watch-sync -recursive=false -actions prod-ftp# Enable verbose loggingwatch-sync -verbose -actions backup-rsync
The configuration file is stored at~/.watch-sync.json
. If it doesn't exist, a default one will be created.
Example configuration:
{"actions": {"prod-ftp": {"type":"ftp","settings": {"host":"ftp.example.com","port":21,"user":"username","password":"password","remote_dir":"/public_html" } },"staging-sftp": {"type":"sftp","settings": {"host":"sftp.example.com","port":22,"user":"username","password":"password","key_file":"/path/to/private_key","remote_dir":"/var/www" } },"backup-rsync": {"type":"rsync","settings": {"host":"example.com","user":"username","remote_dir":"/var/www/html","options":"-av --delete" } } },"filters": {"exclude": [".git","node_modules","*.tmp","vendor","*.log"] }}
With this configuration, you can reference your actions by name when running the command:
watch-sync -actions prod-ftp,staging-sftp
- Fixed rsync path preservation: rsync now correctly preserves directory structure on the remote server
- Ignore CHMOD events: CHMOD events no longer trigger synchronization actions
- Better error handling: Improved error logging and recovery
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see theLICENSE file for details.
About
📁 Watch-Sync: Real-time file synchronization tool that watches for changes and instantly syncs via FTP, SFTP, and rsync. Perfect for web developers maintaining remote servers, with smart directory structure preservation and flexible configuration options. ⚡ Simplify your workflow!