Write a file-reorganising script from a mapping table

A file-reorganising script with a dry-run mode that prints every proposed move and an undo log format.

Choose one of three approaches. The steps for that option appear below.

Choose an option above. On a phone, swipe the tabs left or right to see all options →

Claude: checks mapping, drafts script, you run it

Claude checks your mapping and drafts a dry-run-first script. You decide collisions and run the script yourself.

  1. You

    Gather files

  2. Claude

    Check mapping

  3. You

    Decide collisions

  4. Claude

    Draft script, table

  5. You

    Back up and run

  1. Gather the listing and mapping CSV

    Use: You

    Have ready: the folder listing and the old-to-new mapping CSV.

    Check

    Check both files are the versions you mean to use.

  2. Check the mapping for collisions

    Use: Claude

    Ask Claude to check the mapping table for collisions and unmapped names and propose fixes.

    Details

    What to paste into the tool

    Task: Collision list; Unmapped files; Proposed fixes. Check the mapping for collisions (two old patterns mapping to the same new path) and for files that match no pattern. Return a collision list, an unmapped list, and a proposed fix for each. Do not invent mappings for unmapped files; flag them.

  3. Decide collisions and approve the mapping

    Use: You

    Read the collision and unmapped lists, decide how each collision is resolved and approve the final mapping CSV.

    Check

    Decide how each collision is resolved. Check every unmapped file stays explicitly unmapped.

  4. Draft the script and expected moves

    Use: Claude

    Ask Claude for a script with dry-run default and undo log, then an expected dry-run table from the listing.

    Details

    What to paste into the tool

    Task: Script file content; Usage notes. Draft a script that applies this approved mapping CSV to this folder listing. Requirements: dry-run is the default and prints every proposed move; moves are copy-then-rename operations, and deletion is never part of the script; it writes an undo log (old path, new path, timestamp) for every move; it stops on any name not covered by the mapping and reports it as 'unmapped'. Keep the codes as they are. Include short usage notes. Task: Expected move table covering every listed file exactly once. Using the listing, the approved mapping and the usage notes, produce the table the script's dry run should produce: every listed file exactly once, each with a destination or an explicit 'unmapped'. Do not add or drop files. Keep the codes as they are.

  5. Back up, dry-run, then run the script yourself

    Use: You

    Back up first. Run the dry run, compare it with the expected table, then run the real moves yourself.

    Check

    Check the script defaults to dry-run and contains no delete operation. Keep a backup before running. Run the dry run and check it lists each listing file exactly once with a destination or an explicit 'unmapped', matching the expected table; only then run the real moves yourself. The workflow changes no files.

Before you paste into any AI tool, remove any confidential information. Put it back at the end.

Tools in this workflow

Deciding between ChatGPT and Claude for this? See the comparison.

Final check

Owner decides every collision resolution before drafting.

Owner reads the script and confirms it defaults to dry-run and contains no delete operation.

Owner compares the expected table with the real dry-run output.

Owner keeps a backup and runs the script themselves; the workflow changes no files.

Dry run lists each listing file exactly once with a destination or explicit 'unmapped'.

Check the result against your original inputs. Approve it before sharing or acting.

What still needs checking
  • Exact message-size or upload limits for an ~800-name listing are not published on the cited pages, so paste/upload feasibility is unchecked in every option.
  • ChatGPT and Cursor plan-level data terms were not captured on this read.
  • Whether any vendor trains on the pasted or uploaded listing under the owner's plan is still to confirm for options A, B and C.
  • Option C: the cited cursor.com quote covers handed-off tasks, autonomous and parallel work and terminal use only; reading and writing files in a local working folder is not covered and is unchecked.

Share this page