Hot Folder
You'll set up a folder that watches for new files and does something useful to each one the moment it lands.
About
A hot folder watches for new files and acts on them. Drop an image in and get a resized copy, or drop a PDF in and it gets named by date and filed away. Folder Actions on Mac, inotifywait on Linux and a small Python watcher anywhere all do the job. It's the first automation that looks like magic to people watching, and it's an afternoon of work.
At a glance
- Per requirement
- 25 XP
- Completion bonus
- 150 XP
- Requirements
- 5
- Takes
- One weekend
- Skill level
- Intermediate (months of practice)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- With other people
Requirements
-
1
Set up a watcher that logs the name of any file dropped into a folder. Use inotifywait on Linux, fswatch on Mac, watchdog in Python or Folder Actions in Automator. Start with just logging, so you know the watcher sees the file before you ask it to do anything. Film a file being dropped in and its name appearing in the log. Video
-
2
Make it do one real thing to each file: resize, convert, rename or move. Images to 1200 pixels wide with ImageMagick, audio to mp3 with ffmpeg, or PDFs renamed with today's date all count. Pick one action and do it well. Film a drop and the result appearing. Video
-
3
Handle the file that's still being copied. A watcher fires the moment the file appears, which is often before it has finished writing. Wait until the size stops changing, or watch for the close event instead. Test it with a large file. Film a big file arriving and being processed correctly. Video
-
4
Make it survive a reboot. Use a launch agent, a systemd user service or a startup item. Then reboot and drop a file in without starting anything by hand. Film the drop working after the restart. Video
-
5
Give the folder to someone else and watch them use it. Share it over the network or put it in a synced folder. The nice test is someone dropping a photo in from their phone and getting the resized one back. Film them doing it, or take a photo of them with the result on their screen. Photo or video