Organise Your Local File Directories With AI n8n Workflow Template

n8n workflow template · 10 nodes · Mistral AI

Organise Your Local File Directories With AI is a free n8n workflow template that starts from the Local File Trigger node and works with Mistral AI. It has 10 nodes, 3 of them AI nodes (Mistral Cloud Chat Model, Structured Output Parser and Basic LLM Chain). The notes inside the workflow say: “This workflow manipulates the filesystem. Always make backups of your files before running local workflows.” To run it, you add your own credentials for Mistral Cloud API.

At a glance

Trigger
Local File Trigger (Local File Trigger)
Nodes
10
Apps
Mistral AI
AI nodes
3
Credentials
1 type
Category
AI agents and LLM tools

Apps and integrations

  • Mistral AI

Node types used

  • Local File Trigger
  • Execute Command
  • Edit Fields (Set)
  • Mistral Cloud Chat Model
  • Structured Output Parser
  • If
  • Split Out
  • Basic LLM Chain

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Warning! Potential destructive operations ahead!

This workflow manipulates the filesystem. Always make backups of your files before running local workflows.

Try It Out!

This workflow does the following

  • Monitors a target folder for changes using the local file trigger
  • identifies all files and subdirectories in the target folder and passes this to Mistral AI
  • Mistral AI suggests where to move top level files into which subdirectories. It can also suggest subdirectories tp create if none are suitable.
  • Finally, we take the AI's suggestions are perform the move operations using the execute command node.

Need Help?

Join the Discord or ask in the Forum!

Step 1. Select the target folder

Read more about local file trigger

In this workflow, we'll monitor a specific folder on disk that n8n has access to. Since we're using docker, we can either use the n8n volume or mount a folder from the host machine.

The local file trigger is useful to execute the workflow whenever changes are made to our target folder.

Step 2. Identify files that need to be organised

Read more about Execute Command node

For all Files in the root level of our selected target folder, we want them to be sorted and moved into categorised subdirectories. In this step, we'll use linux commands to get a list of files and folders currently present in the target folder.

Step 3. Using Mistral AI to organise our target folder

Read more about Mistral AI

Using Mistral AI as our AI file manager, it can help us suggest which files go into which categorised subdirectory. If the subdirectory doesn't exist, Mistral can also suggest one to be created.

Step 4. Move the files into subdirectories

Read more about Execute Command node

For this step, we'll use the execute command node to execute a shellscript to move the files into their respective subdirectories.

Nodes in this workflow

The 10 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. Local File Trigger (Local File Trigger)
  2. Get Files and Folders (Execute Command)
  3. Files and Folders to Array (Edit Fields (Set))
  4. Mistral Cloud Chat Model (Mistral Cloud Chat Model)
  5. Structured Output Parser (Structured Output Parser)
  6. Set Variables (Edit Fields (Set))
  7. Move Files into Folders (Execute Command)
  8. If Has Target Files... (If)
  9. Get Suggestions to List (Split Out)
  10. AI File Manager (Basic LLM Chain)

Credentials you need

  • Mistral Cloud API – used by Mistral Cloud Chat Model

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us