Build a File Automation Workflow with Claude Code
Build a File Automation Workflow with Claude Code
What you'll build
An automated pipeline that watches a folder, transcribes audio, renames files intelligently, and sorts everything into organized folders.
The Problem
Your Downloads folder has 847 files. Screenshots named IMG_4829.png. Meeting recordings from three months ago you never transcribed. That PDF you need right now but can't find because it's buried under voice-memo-final-FINAL-v2.m4a. Every week you promise yourself you'll organize it. You never do.
What You're Building
An automated file pipeline: drop a file into a folder and the agent detects it, transcribes audio, generates a descriptive filename based on content, and sorts it into the right place. Zero manual work.
Milestone 1: Build a Folder Watcher
First, the agent needs eyes. Let's make it watch a folder for new files.
Create a skill for my OpenClaw agent that watches my ~/Downloads folder for new files. When a new file appears, the agent should log the filename, file type, and size. Use OpenClaw's file system tools. Start simple — just detection and logging for now.
What Claude Code does: It creates an OpenClaw skill with a file watcher that monitors a directory for changes. OpenClaw skills can hook into file system events — when a new file lands in the watched folder, the skill triggers and passes the file info to the agent. This is the foundation: detect first, then process.
Try it: Drop any file into your Downloads folder. Check the OpenClaw logs — you should see a new entry with the filename, type, and size.
Milestone 2: Auto-Transcribe Audio and Video
Most of those files gathering dust are recordings you never transcribed. Let's fix that.
Extend my file watcher skill to handle audio and video files. When an .mp3, .m4a, .wav, or .mp4 file is detected, the agent should: 1) Extract audio if it's a video, 2) Transcribe the audio using Whisper (install if needed — first run may take a few minutes to download the model), 3) Save the transcript as a .txt file next to the original. Keep the watcher running for other file types too.
What Claude Code does: It adds a processing pipeline to your watcher. The agent chains tools together — it detects the file type, selects the right processor (ffmpeg for video extraction, Whisper for transcription), and runs them in sequence. Each step feeds into the next. One new file triggers a whole workflow.
Try it: Drop an audio file (any .mp3 or voice memo) into Downloads. Wait 10-15 seconds. A new .txt file should appear next to it with the full transcript.
Milestone 3: Smart File Organization
Files detected. Audio transcribed. Now let's sort everything into the right place.
Add file organization to my watcher skill. Create a folder structure at ~/Organized with subfolders: Documents, Images, Audio, Video, Code, and Other. When a new file is detected, the agent should analyze the file (not just the extension — read the content if possible) and move it to the correct subfolder. PDFs about finances go to Documents, screenshots go to Images, code files to Code, etc.
What Claude Code does: It adds intelligent sorting to the pipeline. The agent reads file content to decide where it goes — not just file extensions. A .pdf could be an invoice, a contract, or a resume. The agent uses the AI model to analyze the content and pick the right destination. This is smarter than any rule-based file sorter.
Try it: Drop a PDF and an image into Downloads. Check ~/Organized/ — the PDF should be in Documents, the image in Images.
Milestone 4: AI-Powered Renaming
Files are sorted, but they're still named IMG_4829.png and voice-memo-2026-02.m4a. Let's fix that.
Add smart renaming to my file automation pipeline. Before moving a file to its organized folder, the agent should: 1) Analyze the file content (read text from PDFs, look at image content, read transcripts), 2) Generate a descriptive filename based on the content, 3) Add a date prefix in YYYY-MM-DD format, 4) Rename and then move. Example: IMG_4829.png becomes 2026-02-22_team-standup-whiteboard.png.
What Claude Code does: It adds an AI naming step before the move. The agent generates filenames based on content analysis, not timestamps. For images, it describes what's in the photo. For PDFs, it reads the title or subject. For transcripts, it pulls the main topic. Every file gets a human-readable name that actually helps you find it later.
Try it: Drop a screenshot into Downloads. Check ~/Organized/Images/ — it should have a descriptive name with a date prefix, not IMG_something.
Milestone 5: Test the Full Pipeline
Everything is wired up. Let's watch the full chain in action.
Show me the OpenClaw logs in real time. I'm going to drop three files into Downloads: a PDF, an audio file, and a screenshot. I want to watch the complete pipeline for each: detect → analyze → transcribe (if audio) → rename → organize. Show me the before and after — original filenames vs. final locations.
What Claude Code does: It opens the live log stream so you can watch the complete automation chain in real time. Each file triggers: detection → type analysis → processing (transcription for audio/video) → content analysis → smart rename → move to organized folder. Three files, three parallel pipelines, zero manual work.
Try it: Drop the files. Watch the logs. Then check ~/Organized/ — three files, properly named, in the right folders. Your new Downloads arrivals have been handled automatically.
What You Built
Remember that Downloads folder with 847 files? You just built the system that prevents it from ever getting that bad again. Every new file gets:
- Detected automatically the moment it lands
- Transcribed if it's audio or video
- Analyzed by AI to understand its content
- Renamed with a descriptive, searchable name
- Sorted into the right folder
This runs silently in the background. Drop a file, walk away. It handles the rest.
Take It Further
- Add email attachment processing — save Gmail attachments to the watched folder automatically
- OCR for images — extract text from screenshots and photos
- Weekly digest — have the agent send you a summary of everything it organized this week
Ready to build your first AI agent?
Live Zoom workshop + 1 month WhatsApp follow-up with Yuval Keshtcher (Hebrew)
Learn about the Workshop