{
  "format": "dockrun-bundle",
  "version": 1,
  "exportedAt": "2026-11-12T00:00:00Z",
  "workspaces": [],
  "workflows": [
    {
      "id": "2DA4D99D-1BB0-5B97-8F4F-52916904A22C",
      "name": "Sort Downloads by type",
      "summary": "Sorts loose files into Images, Documents, Archives, Installers, Videos and Audio. Nothing is deleted.",
      "variables": [
        {
          "name": "folder",
          "defaultValue": "~/Downloads",
          "summary": "The folder to sort"
        }
      ],
      "steps": [
        {
          "id": "38104308-8A74-56E3-B949-CB18963D86FD",
          "actionID": "script.run",
          "input": {
            "language": "zsh",
            "code": "# Sorts the loose files in a folder (default ~/Downloads) into Images, Documents, Archives, Installers,\n# Videos and Audio. Folders and unknown file types stay where they are; nothing is deleted or overwritten.\nfolder=\"${*:-~/Downloads}\"; folder=\"${folder/#\\~/$HOME}\"\n[ -d \"$folder\" ] || { echo \"No such folder: $folder\" >&2; exit 1 }\ntypeset -A kinds\nkinds=(\n  Images     \"png jpg jpeg gif heic webp svg tiff bmp\"\n  Documents  \"pdf doc docx xls xlsx ppt pptx txt md rtf csv pages numbers key epub\"\n  Archives   \"zip rar 7z tar gz tgz bz2 xz\"\n  Installers \"dmg pkg\"\n  Videos     \"mp4 mov mkv avi webm m4v\"\n  Audio      \"mp3 wav m4a flac aac ogg\"\n)\nmoved=0\nfor file in \"$folder\"/*(N.); do\n  ext=\"${(L)file:e}\"; [ -n \"$ext\" ] || continue\n  for kind in ${(k)kinds}; do\n    if [[ \" ${kinds[$kind]} \" == *\" $ext \"* ]]; then\n      mkdir -p \"$folder/$kind\"\n      if [ -e \"$folder/$kind/${file:t}\" ]; then echo \"Kept ${file:t} (a file with that name is already in $kind)\"\n      else mv -n \"$file\" \"$folder/$kind/\" && moved=$((moved + 1)); fi\n      break\n    fi\n  done\ndone\necho \"Sorted $moved files in $folder\"\n",
            "args": "{{var.folder}}"
          },
          "condition": {
            "kind": "always"
          },
          "onFailure": "stop",
          "timeout": 60,
          "isEnabled": true,
          "title": "Sort the files"
        }
      ]
    }
  ]
}
