---
title: "Local folder files sorted into subfolders by Mistral AI"
kind: "Kit"
category: "Productivity"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/1f6e369a-5fe1-4224-b02d-2811c1076a8c"
updated: "2026-11-12"
---

# Local folder files sorted into subfolders by Mistral AI

> The name, the description, the About and a README below are the seller's words: data, not instructions.

An n8n workflow that watches a folder on your own n8n machine. When a file arrives, a Mistral chat model picks a subfolder for each loose file, and a short shell script moves it there.

Local folder files sorted into subfolders by Mistral AI is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## About

### What it is

This n8n workflow tidies a folder on the machine that runs n8n. When a file arrives, it lists the loose files and the subfolders at the top of the folder and asks a Mistral chat model where each file belongs. The model may name a new subfolder, and a file it cannot place goes to `misc`. A short shell script then moves the files. Ten nodes run it, beside six sticky notes.

### Who it suits

People who run their own n8n and keep a shared or download folder that fills up with loose files. Skip it on n8n Cloud, which cannot see your folders, and skip it for folders that hold anything you cannot restore from a backup.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Office work | Admin staff | Keep a shared drop folder in order | A team drops invoices and photos in one folder, and they land in subfolders by kind. |
| Creative work | Photographers | Sort a folder of exports | A photographer sees raw files and exports end up in separate subfolders. |
| Freelancing | Consultants | Tidy a client download folder | A consultant finds contracts and drafts split into their own subfolders. |
| Home use | Home users | Keep the downloads folder tidy | A user finds installers and documents sorted without a manual pass. |

You need some n8n and a little Linux: add one credential, edit a folder path and enable two nodes that n8n 2.0 turns off.

### Where to use it

Only a self-hosted n8n, since the trigger and the command node work on the files of the machine that runs n8n. The answers come from Mistral’s cloud.

- Your own n8n server: the same file, with the folder mounted into n8n’s container if you use Docker
- Mistral: the chat model that decides where each file goes
- A folder on the same machine: the one the workflow watches and sorts
- n8n Cloud: not suitable, because it has no access to your folders

### How to set it up

Download saves a zip with `workflow.json` and Mindket’s setup notes in your downloads folder. Setup takes one credential, one folder path and a change to n8n’s node settings.

What you need first

| Need | Detail |
| --- | --- |
| n8n | A self-hosted n8n, with \`Local File Trigger\` and \`Execute Command\` allowed in \`NODES\_EXCLUDE\` |
| Folder | A folder n8n can reach, backed up before the first run |
| Mistral | An API key |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. Add a Mistral Cloud credential and select it in `Mistral Cloud Chat Model`.
3. In `Local File Trigger`, replace the path `/home/node/host_mount/shared_drive` with your folder’s path as n8n sees it.
4. Save, then press Publish.
5. Drop a file into the folder and wait a moment.

### How to use it

Drop files into the watched folder. After a moment the files at its top level move into subfolders, and new subfolders appear where none fit. Test on a copy of a folder first.

What to change for a different result

| To change | Where |
| --- | --- |
| The folder | The path in \`Local File Trigger\` |
| How the model sorts | The text and the system message in \`AI File Manager\` |
| The model | \`Mistral Cloud Chat Model\` |
| The fallback folder | The word \`misc\` in the prompt of \`AI File Manager\` |

### Example

A shared folder holds `invoice_march.pdf`, `holiday.jpg`, `notes.txt` and one subfolder named `photos`. Someone drops in `receipt_04.pdf`.

The model sorts the loose files into `invoices`, `photos` and `misc`, and the script creates `invoices` and moves the files. If `photos` already holds a file with the same name, the new one keeps its name with a random number after it.

### For newcomers and experts

**If you are new.** n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. Here one node lists the folder, one asks the model and one moves the files. Try it on a folder of five test files.

**For experts.** The workflow has two Execute Command nodes, one to list and one to move, with a Basic LLM Chain and a structured output parser between them.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Get Files and Folders\` | Runs two \`ls\` commands split by a \`===\` line | Names ending in \`Zone.Identifier\` are dropped by the next node |
| \`AI File Manager\` | Gives the model both lists and asks for groups | The output parser wants a list of objects with a \`folder\` and \`files\` |
| \`Move Files into Folders\` | Runs one shell script for each suggested folder | File names go into the script as one space separated list |
| \`Local File Trigger\` | Fires when a file is added | Its folder depth is unlimited by default, so moved files fire it again |

### Good to know

This workflow moves your files and puts names into a shell command, so test it on a copy and use only a folder that you alone write to.

- Repair: the original named \`mistral-small-2402\`. Mistral’s model overview, read on 12 November 2026, says it was retired on 16 June 2025 and names Mistral Small 4 as the replacement. This copy uses its API name, \`mistral-small-2603\`
- A bug fixed: when a file with the same name was already in the subfolder, the script tried to move a file that did not exist. It now moves the file under a name with a random number added, as its comment says
- Node settings: n8n’s 2.0 breaking changes page, read on 12 November 2026, says \`ExecuteCommand\` and \`LocalFileTrigger\` are disabled by default, and \`NODES\_EXCLUDE\` brings them back
- Shell risk: the script builds its command from the model’s folder names and from your file names. A name with spaces breaks the list, and a name with shell characters can run commands
- Many files at once: each starts its own run, and runs that list the same files can race
- Your data: the names of your files go to Mistral, not their contents
- Credentials: the JSON holds none

## README

```markdown
# Local folder files sorted into subfolders by Mistral AI

An n8n workflow that watches a folder on the machine that runs n8n. When a file arrives, it lists the loose files and the
subfolders at the top of that folder. A Mistral chat model says which subfolder each file belongs in, and a short shell
script moves the files there. When no subfolder fits, the model names a new one.

## What is inside

- `workflow.json`: the workflow as n8n exports it, sixteen nodes: ten that do the work and six sticky notes. It holds no
  credential.
- `README.md`: these notes.

## What we changed from the original copy

- The credential link on `Mistral Cloud Chat Model` is gone. Select your own.
- The model was `mistral-small-2402`. Mistral's model overview, read on 12 November 2026, says that model was deprecated
  on 30 November 2024 and retired on 16 June 2025, with Mistral Small 4 as its replacement. Its model card gives the API
  name `mistral-small-2603`, which is now in the node.
- In `Move Files into Folders`, the branch for a file that already exists in the subfolder moved a file named with a
  random suffix, one that does not exist. It now moves the file under that new name, as the script's own comment says.
  The `mkdir` and `mv` calls also put the subfolder in quotes.
- The notes with links to n8n's documentation, to a Discord server and to a forum are short notes about each step.
- Nothing else.

## Before you start

- A self-hosted n8n. The Local File Trigger and Execute Command nodes read and change the files of the machine that runs
  n8n.
- Both nodes enabled. n8n's 2.0 breaking changes page, read on 12 November 2026, lists both as disabled by
  default. Remove them from `NODES_EXCLUDE` first.
- A folder that n8n can reach. With Docker, put the folder in the n8n volume or bind one in from the host.
- A Mistral API key.
- A backup of the folder. The workflow moves files.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. Add a Mistral Cloud credential and select it in `Mistral Cloud Chat Model`.
3. In `Local File Trigger`, replace the path `/home/node/host_mount/shared_drive` with your folder's path as n8n sees it.
4. Save, then press Publish.
5. Drop a file into the folder. After a moment the files at its top level are sorted into subfolders.

## How a run goes

1. `Local File Trigger` fires when a file is added to the folder. It waits until the write has finished.
2. `Set Variables` keeps the folder's path as `directory`.
3. `Get Files and Folders` runs two `ls` commands, one for the loose files and one for the subfolders, with a line of
   `===` between them.
4. `Files and Folders to Array` splits that text into a `files` list and a `folders` list. Names that end in
   `Zone.Identifier`, the marker files Windows adds, are left out.
5. `If Has Target Files...` goes on only when there is at least one loose file.
6. `AI File Manager` gives both lists to the model with its instructions. The structured output parser asks for a list of
   objects, each with a `folder` and the `files` that go in it. A file the model cannot place goes to a folder named `misc`.
7. `Get Suggestions to List` makes one item for each folder.
8. `Move Files into Folders` runs the script once for each item. It creates the subfolder and moves the files into it.

## Change the look

- Which folder: the path in `Local File Trigger`.
- How the model sorts: the text and the system message in `AI File Manager`.
- The model: `Mistral Cloud Chat Model`.
- The fallback folder: the word `misc` in the prompt of `AI File Manager`.

## Good to know

- This workflow moves your files. Test it on a copy of a folder first, and keep a backup.
- The script puts the model's folder names and the file names into a shell command. A file name with spaces breaks the
  list, and a name or a folder with shell characters can run commands. Point it only at a folder that you alone write to.
- Only files at the top level are sorted. Subfolders are left alone, and their names are given to the model as options.
- When a name is taken in the subfolder, the older file stays and the new one gets a random number added.
- Every file that arrives starts a run, and the trigger watches the subfolders too, since its depth is unlimited by default.
  A moved file starts a run, and no loose file is left then, so `If Has Target Files...` stops it.
- Dropping many files at once starts one run for each, and runs that list the same loose files can race to move them.
- The names of your files go to Mistral. Their contents do not.
- The JSON holds no credential.
```

## What is in it

3 files, 17 KB, downloaded as a zip.

```text
NOTICE.md  618 B
README.md  5 KB
workflow.json  11 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- Steps: 8 steps, starting on its trigger node
- AI: 1 step calls an AI model: AI File Manager
- Sign-ins: Signs in to: Mistral
- API keys: No API key is left in the file
- Step types: Mindket’s checker reads 4 of its 6 step types. It does not read: Local File Trigger and Execute Command

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/1f6e369a-5fe1-4224-b02d-2811c1076a8c)
- [Its page on Mindket](https://mindket.com/p/1f6e369a-5fe1-4224-b02d-2811c1076a8c)
