ArTchie Studios

Orphan Meta Cleaner

Finds leftover .meta files whose asset is gone, and empty folders, by walking Assets/ on disk (not only AssetDatabase).

Editor-only. Unity 2021.3+. Lives in Anvil.Editor (includePlatforms: Editor). No extra packages.

Default is report-only. Nothing is deleted. The window can move orphans into quarantine; batch mode does the same only with -anvil-quarantine.

Editor window

ArTchie / Anvil / Orphan Meta Cleaner

Button What it does
Scan Walks Assets/ on disk for orphan .meta files and empty directories.
Copy JSON Puts the report JSON on the clipboard.
Write report Writes <project>/AnvilReports/orphan-metas.json (creates the folder if needed).
Move orphans to AnvilReports/quarantine Moves reported items to <project>/AnvilReports/quarantine/ (preserves Assets/… relative paths). Does not permanently delete. Then rescans.

Batchmode (CI)

Unity -batchmode -nographics -quit -projectPath <proj> -executeMethod Anvil.OrphanMetaCleaner.RunBatch -anvil-out <file.json> -anvil-fail
Arg Meaning
-anvil-out <file.json> Output path. Default: <project>/AnvilReports/orphan-metas.json
-anvil-fail Exit code 1 if any orphan/empty folder was found; otherwise 0
-anvil-quarantine After writing the report, move items to AnvilReports/quarantine

Without -anvil-quarantine, batch mode only writes the report.

RunBatch only calls EditorApplication.Exit when Application.isBatchMode is true. It logs count= and the output path.

Also accepts -anvil-out=file.json.

JSON

{
  "tool": "OrphanMetaCleaner",
  "generatedUtc": "2026-08-18T02:00:00Z",
  "count": 2,
  "items": [
    {
      "path": "Assets/DeletedScript.cs.meta",
      "kind": "orphan-meta",
      "guid": "deadbeefdeadbeefdeadbeefdeadbeef"
    },
    {
      "path": "Assets/EmptyFolder",
      "kind": "empty-folder",
      "guid": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    }
  ]
}

kind is orphan-meta or empty-folder. guid comes from the .meta (the folder’s sibling .meta for empty folders). Empty string if the meta is missing or has no guid.

Notes

  • A .meta is orphan when path without the .meta suffix is neither a file nor a folder.
  • A folder is empty when it has no entries except *.meta. .DS_Store / Thumbs.db keep a folder “not empty”.
  • The Assets/ root itself is never reported as empty-folder.
  • Skips Packages/ and Library/. Empty projects are fine (count: 0).
  • Quarantine refuses paths outside Assets/. If the destination already exists, a .anvil-<utc> suffix is appended.
  • Quarantine is one pass: a parent that only contains empty child folders is not empty until those children are moved (rescan / run again).
  • Moving an empty folder also moves its sibling FolderName.meta when present.
  • Does not permanently delete. Does not touch runtime player code.

Source in the box: Assets/ArTchie Studios/ArTchie-Suite/com.artchie.anvil/Documentation/OrphanMetaCleaner.md