Station AcademyActivity referenceRPAi StationConsultingAurora Academy
Academy/Station Academy/Level P/Project: tidy a folder by file type
Level P · Practical projects

Project: tidy a folder by file type

Beginner project. Sort every file in an inbox folder into sub-folders by file type, safely, in a practice folder.

Beginner≈ 25 min (estimate)Windows, macOSWorkflow engine-tested
Before this lesson
Files and folders
You will learn to
  • Combine List Files, a loop, Regex and File Operation
  • Run safely on test files
Sample files
practice-folder-setup.station.json · tidy-inbox.station.json

Scenario. Your Downloads or inbox folder fills up with mixed files. You want them sorted into folders by type.

Supported: Windows and macOS (on Windows, set the folder variable first). Station version: see the note at the end of the page.

Input and output

  • Input: {{folder}}/inbox with four test files, created by practice-folder-setup.station.json.
  • Output: {{folder}}/sorted/txt, sorted/csv and sorted/json with the files moved into them.

Steps

  1. Import and run Practice folder setup.
  2. Import Tidy the inbox by file type (tidy-inbox.station.json) and read it in Advanced:
    • Files in the inbox: List Files → files.
    • For each file: Loop over files as file.
    • Find the extension and Find the file name: Regex match with [^.\\/]+$ and [^\\/]+$.
    • Make the type folder: File Operation create_folder {{folder}}/sorted/{{ext}}.
    • Move the file: move to {{folder}}/sorted/{{ext}}/{{fileName}}.
  3. Run it.

How it works

The loop handles any number of files. The regular expressions take everything after the last dot (extension) and after the last slash (name), on Windows and Mac paths alike.

Troubleshooting

  • Could not find or nothing moved: check the folder variable and that setup ran.
  • A file without an extension ends up in a folder named after its whole name. Add an If Condition to skip such files.

Optional improvements

  • Use copy instead of move until you trust it.
  • Skip files newer than today with the DateTime activities.
  • Point it at a copy of a real folder, never at the original first.

Activities in this lesson

List Files · Loop · Regex · File Operation · Math · Log

Saved only in this browser.

Workflow engine-tested. The sample workflow was executed with the macOS Station engine (StationCore) without the user interface. UI steps are source-verified. Written against RPAi Station for macOS 0.1.0 (1) (RPAi_Station_2.0 @ port/macos 9864e96) and the Windows source (RPAi_Station_2.0 @ codex/native-station e68f16d). Reviewed 2026-11-30. UI labels may differ slightly in other versions; see versions and changes.