Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
40
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
FTP Sync CI is a single-file Python tool that watches local directories for file changes and automatically syncs them to remote servers via FTP, FTPS, or SFTP. It is designed for editors (like Zed) that lack built-in remote sync.
# Install dependencies pip install -r requirements.txt # watchdog, paramiko # Run with default config.json python file_sync.py # Run with custom config python file_sync.py -c myconfig.json # Generate example config file python file_sync.py --create-config # Test connection without syncing python file_sync.py --test-connection # Download all remote files to local directory python file_sync.py --download # Via wrapper scripts (auto-install deps) ./sync.sh # Unix/Linux sync.bat # Windows
There are no tests, linting, or build steps configured.
Everything lives in
file_sync.py (~620 lines). The classes form a pipeline:
connect, upload, download, delete, walk_remote, close). SFTPUploader uses paramiko; FTPUploader uses stdlib ftplib.FileSystemEventHandler) — Receives filesystem events, applies ignore patterns, and queues uploads with a 0.5s debounce to batch rapid changes.protocol field, wires up the watchdog Observer, and runs the main loop (sleep 0.1s → process_pending_uploads).on_created/on_modified → schedule_upload (checks auto_upload config, adds to pending_uploads dict with timestamp) → main loop calls process_pending_uploads after 0.5s delay → uploader.upload()on_deleted → checks auto_delete config → immediate uploader.delete() (no debounce)--download CLI flag → download_all_files() → uploader.walk_remote() recursively lists remote files → uploader.download() for each file_downloaded_paths with timestamps. schedule_upload skips any file downloaded within the last 10 seconds, preventing download→upload loops.get_remote_path() computes relative path from local_path, joins with remote_path, normalizes to forward slashes*.pyc) match via suffix; plain names (.git, node_modules) match against individual path componentsJSON config file (default
config.json). See config.example.json for template. Key fields:
| Field | Description | Default |
|---|---|---|
| , , or | |
| Remote server hostname | — |
| Remote server port | 22 (sftp) / 21 (ftp) |
| Login username | — |
/ | Auth credentials (key_file for SFTP only) | — |
| Local directory to watch | — |
| Remote directory to sync to | — |
| List of patterns to exclude | |
| Create remote dirs as needed | |
| Use passive mode for FTP | |
| Auto-upload files on local changes | |
| Auto-delete remote file on local delete | |
| Upload all files on startup | |