A small Python script to organize Datadog agent flare ZIPs:
- Prompts for a Zendesk ticket number
- Moves the latest
.zipfile fromDownloads/into a folder likeTicket_<number>/ - Unzips each flare into an auto-numbered subfolder (
unzipped_1/,unzipped_2/, …)
Perfect for Datadog TSEs managing multiple flare submissions.
- ✅ Native macOS prompt (via GUI)
- ✅ Auto-handles duplicate ZIPs and folders
- ✅ Works as a one-liner via Terminal alias
- ✅ Or as a quick-trigger script in Raycast
Save the script as flaresort.py somewhere permanent, e.g.:
/Users/yourname/scripts/flaresort.py
Make sure it's executable with the correct Python path:
chmod +x /Users/yourname/scripts/flaresort.pyUse which python or pyenv which python to get your full Python path. Example:
/Users/yourname/.pyenv/versions/3.11.9/bin/python
Open your shell config:
nano ~/.zshrcAdd this line:
alias flaresort='/Users/yourname/.pyenv/versions/3.11.9/bin/python /Users/yourname/scripts/flaresort.py'Then reload your shell:
source ~/.zshrcWhenever you get a new agent flare ZIP in ~/Downloads, just run:
flaresort- Make sure the Python script is saved and tested
- Know your full Python + script path
In Raycast:
- Search for
Create Script Command - Choose: "Full Script"
- Fill out the fields:
| Field | Value |
|---|---|
| Name | Organize Flare |
| Language | Bash |
| Output Mode | Full Output |
| Command | (see below) |
Paste this into the Command field:
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Organize Flare
# @raycast.mode fullOutput
# Optional parameters:
# @raycast.icon 📦
# @raycast.packageName Flare Tools
# Documentation:
# @raycast.description Move and unzip the latest flare into a ticket folder
# @raycast.author Your Name
# @raycast.authorURL https://www.datadoghq.com
PYTHON="/Users/yourname/.pyenv/versions/3.11.9/bin/python"
SCRIPT="/Users/yourname/scripts/flaresort.py"
TICKET_FOLDER=$($PYTHON "$SCRIPT" | tee /dev/tty | tail -n 1)
if [[ -d "$TICKET_FOLDER" ]]; then
open "$TICKET_FOLDER"
else
echo "⚠️ Ticket folder not found."
fiBe sure to replace
PYTHONandSCRIPTpaths with your real ones.
Open Raycast (Cmd + Space) → search for Organize Flare → hit Enter.
- You’ll get a prompt to enter the ticket number
- The ZIP will be moved & extracted
- The folder will open in Finder automatically
~/Downloads/Agent_Flares/
└── Ticket_SV015767v/
├── datadog-agent-2025-08-debug.zip
├── unzipped_1/
├── unzipped_2/
- macOS (for AppleScript prompt)
- Python 3.6+
zipfile,shutil,pathlib(standard library)
Let me know if you’d like me to generate a flaresort.command file or a ready-to-install Raycast .sh script!