A macOS Python script that creates a timestamped ZIP archive from whatever is currently selected in Finder — works as a Raycast script command or standalone CLI tool.
- Finder integration — reads selection via AppleScript; no file picker, no drag-and-drop
- Files and folders — single files, multiple files, directories, or any mix
- Recursive — entire folder trees are preserved with relative paths inside the archive
- Timestamped names —
archive_20260424_143000.zipsaved next to the selected items; no overwrites - Special characters — custom
|||delimiter in AppleScript prevents comma-in-filename parsing errors - No dependencies — stdlib only (
os,subprocess,zipfile,datetime)
- macOS (AppleScript + Finder)
- Python 3.6+
- Open Raycast → Extensions → Script Commands
- Add
main.pyas a new Script Command - Select files or folders in Finder
- Run "Zip Selected in Finder" from Raycast
# Select files in Finder first, then:
python3 main.pyFinder selection
↓ AppleScript (osascript)
List of POSIX paths
↓
zipfile.ZipFile (ZIP_DEFLATED)
↓
archive_YYYYMMDD_HHMMSS.zip → same folder as selection
Files are archived by basename; directories are walked recursively with paths relative to their parent, so the folder name is preserved inside the archive.
MIT
- GitHub: Shipovmax
- Email: shipov.max@icloud.com