Repository Public License
1# =============================================================================2# SP BOUCHER | SOURCE FILE3# =============================================================================4# Project : ORIX OS Automation5# File : Workflows/Examples/01-smart-downloads-organizer.yaml6# Author : Simon-Pierre Boucher | https://spboucher.ai7# Contact : support@spboucher.ai8# Copyright : (c) 2026 Simon-Pierre Boucher9# License : Proprietary, all rights reserved (see license file)10# =============================================================================11# END OF SP BOUCHER SOURCE HEADER12# =============================================================================1314# ORIX OS Automation15# File: Workflows/Examples/01-smart-downloads-organizer.yaml16# Description: Built-in automation: sorts the files of a folder into category subfolders, moving and never deleting.17#18# Author: Simon-Pierre Boucher19# Contact: contact@spboucher.ai20#21# Limitations22# - Only the top level of the source folder is organised; subfolders and hidden files (dot files) are left where they are.23# - Files are moved, never deleted and never overwritten: filesystem.move refuses an existing destination, so a name24# collision fails that move and stops the run (files already moved stay moved; the run says which one failed).25# - The category comes from the file extension only (see spec.variables.categories); unknown extensions go to "Other".26# - Moving a file out of a folder changes that folder: filesystem.move needs write access to the source as well as to27# the destination, which is why both are listed under permissions.filesystem.write. No delete tool is called.28# - At most 500 entries are listed per run (the default limit of filesystem.list); run it again for larger folders.29apiVersion: orix.ai/v130kind: Automation31metadata:32 id: smart-downloads-organizer33 name: Smart Downloads Organizer34 description: >-35 Sorts the files at the top level of a folder into category subfolders (Documents, Images, Archives, …)36 chosen from their extension. Files are moved after an approval, never deleted, and the run verifies37 that every file arrived.38 tags: [files, organise, downloads]39spec:40 triggers:41 - type: manual42 parameters:43 - name: source44 type: path45 default: ~/ORIX Samples/smart-downloads-organizer/Downloads46 description: Folder to organise.47 - name: destination48 type: path49 default: ~/ORIX Samples/smart-downloads-organizer/Sorted50 description: Folder that receives one subfolder per category.51 permissions:52 filesystem:53 read: ["${{ params.source }}", "${{ params.destination }}"]54 write: ["${{ params.source }}", "${{ params.destination }}"]55 budget:56 maxDurationSeconds: 60057 maxToolCalls: 200058 variables:59 categories:60 .pdf: Documents61 .doc: Documents62 .docx: Documents63 .txt: Documents64 .md: Documents65 .pages: Documents66 .csv: Spreadsheets67 .xlsx: Spreadsheets68 .numbers: Spreadsheets69 .png: Images70 .jpg: Images71 .jpeg: Images72 .heic: Images73 .gif: Images74 .zip: Archives75 .dmg: Archives76 .tar: Archives77 .gz: Archives78 .mp3: Audio79 .m4a: Audio80 .wav: Audio81 .mp4: Video82 .mov: Video83 steps:84 - id: list85 name: List the source folder86 tool: filesystem.list87 with:88 path: ${{ params.source }}89 recursive: false90 - id: files91 name: Keep files only92 needs: [list]93 transform: ${{ filter(steps.list.output.entries, e => e.type == "file") }}94 - id: confirm95 name: Ask before moving96 needs: [files]97 approval: Move ${{ len(steps.files.output) }} file(s) from ${{ params.source }} into category folders under ${{ params.destination }}?98 - id: organize99 name: Move each file to its category100 needs: [confirm]101 foreach: ${{ steps.files.output }}102 as: file103 concurrency: 1104 collect: move105 steps:106 - id: category107 transform: ${{ default(vars.categories[lower(extname(file.name))], "Other") }}108 - id: makeFolder109 needs: [category]110 tool: filesystem.mkdir111 with:112 path: ${{ joinPath(params.destination, steps.category.output) }}113 - id: move114 needs: [makeFolder]115 tool: filesystem.move116 with:117 source: ${{ file.path }}118 destination: ${{ joinPath(params.destination, steps.category.output, file.name) }}119 - id: remaining120 name: List what is left in the source121 needs: [organize]122 tool: filesystem.list123 with:124 path: ${{ params.source }}125 recursive: false126 - id: check127 name: Verify every file was moved128 needs: [organize, remaining]129 verify:130 - equals: ["${{ steps.organize.output.count }}", "${{ len(steps.files.output) }}"]131 - equals: ["${{ count(steps.remaining.output.entries, e => e.type == 'file') }}", 0]132 - id: result133 needs: [check]134 output:135 moved: ${{ steps.organize.output.count }}136 files: ${{ map(steps.organize.output.results, "destination") }}137 destination: ${{ params.destination }}138