Guide for developers

How to clean bin, obj, target and build folders without breaking a project

Build tools leave their output next to your code, and over a few years that output can outweigh the code by a long way. Most of it is safe to delete. The trouble is that a few folders with the same names are not build output at all, so the safe method starts with finding out which is which.

By Randeep Singh, who makes Klenso and builds apps himself. Written 19 November 2026. The commands below are the tools' own, and none of this needs Klenso.

Which folder belongs to which tool

  • bin and obj are the build folders of .NET projects. obj holds intermediate files and bin the finished output.
  • target is where Rust's Cargo puts everything it builds. Maven and sbt use a target folder too.
  • build is used by Gradle (Android and Java), Flutter, CMake and many other tools.
  • .gradle and .dart_tool hold working files for Gradle and Dart.

The names are conventions, not guarantees. A folder called bin in a Node, Python or shell-script project usually holds scripts you wrote, not build output. Look at what is in a folder before you decide.

What comes back, and what does not

Build output comes back the next time you build, because it is made from your source files. Two costs to expect:

  • Time. A large Rust or C++ project can take many minutes to rebuild from nothing.
  • Downloads. A fresh build may need to fetch packages again, so you need an internet connection, and a project that depended on a package that has since been removed may fail to restore.

These do not come back, so check for them first:

  • Anything checked into version control. Some repositories deliberately commit a bin, lib or target folder.
  • Files you added by hand, such as scripts, test data or configuration.
  • Release builds and signing material, for example an .apk, .aab or .ipa you shipped, a mapping.txt you need to read crash reports, or a key or certificate. Many projects put these inside build.

The safest way: the tool's own clean command

Every build tool has a command that removes only what it built. Run it in the project folder:

  • .NET: dotnet clean. Microsoft's documentation says it cleans the output of the previous build, and that both the intermediate (obj) and final output (bin) folders are cleaned.
  • Rust: cargo clean deletes the entire target folder. To preview, add --dry-run. To remove only release builds, use cargo clean --release.
  • Maven: mvn clean. Gradle: gradlew clean. Flutter: flutter clean.

If you are not sure what a command will remove, read the tool's documentation for it first, or use the preview below.

Previewing with Git

If the project is in Git, you can ask Git which files it ignores, which usually means build output. The dry run only lists them and deletes nothing:

git clean -ndX

The -n is the dry run, -d includes folders, and -X limits it to ignored files. Read the list line by line. In my test it listed bin/ and obj/ as expected, and also a .env file, because .env is normally ignored too. Ignored does not mean disposable: local settings and secrets are ignored as well, and they are exactly the files that cannot be rebuilt. Back up anything on the list that you made yourself. Only if the list is all build output would you run the same command with -f instead of -n, and that deletes for good.

Before you delete anything

  • Commit or stash your work. A clean git status means nothing you wrote is at risk.
  • Close the editor and any running build. Open files and background build servers can block the deletion.
  • Pick old projects. A folder you will need tomorrow saves you nothing if you wait for a full rebuild.
  • Be careful in synced folders. A delete inside OneDrive, Dropbox or Google Drive spreads to every device.

If you delete by hand in File Explorer, the folders go to the Recycle Bin, but very large ones may be removed for good, so look at the confirmation.

What Klenso does, and what it does not

Klenso's free scan lists old build, target, .gradle, .dart_tool and node_modules folders, and Python virtual environments, and removes nothing. It offers one only when a project file proves what the folder is, and only when nothing in the project has changed for 90 days. It refuses a folder that holds a key or certificate, a nested .git, a release build (.aab, .apk, .ipa), a mapping.txt, or symbols or outputs folders. These folders rebuild themselves, so they are removed for good, labelled that way, and you must type CLEAN to confirm.

Klenso does not touch bin or obj. Because a bin folder is so often not build output, it is left alone. For .NET projects, use dotnet clean as above. The full rules are on the what Klenso touches page.

The honest limits

A 90-day rule is a guess about which projects you have finished with. It cannot know that you plan to reopen one tomorrow, or that one holds a file you could not recreate. That is why the scan is a list for you to review, and why committing your work first is the best protection of all.

Related guides

Get the free scan More guides