<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dizitart</title>
    <description>The latest articles on DEV Community by Dizitart (dizitart).</description>
    <link>https://dev.to/dizitart</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F16404%2Fb6ed1563-4c16-40da-94e0-0dcb3029a3e5.png</url>
      <title>DEV Community: Dizitart</title>
      <link>https://dev.to/dizitart</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dizitart"/>
    <language>en</language>
    <item>
      <title>I found 21 GB of build folders hiding inside my projects, including ones nested in other projects</title>
      <dc:creator>Anindya Chatterjee</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:37:50 +0000</pubDate>
      <link>https://dev.to/dizitart/i-found-21-gb-of-build-folders-hiding-inside-my-projects-including-ones-nested-in-other-projects-139n</link>
      <guid>https://dev.to/dizitart/i-found-21-gb-of-build-folders-hiding-inside-my-projects-including-ones-nested-in-other-projects-139n</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjdp66fmse884dikgflyl.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjdp66fmse884dikgflyl.gif" alt="Kruftle scanning a folder and reclaiming 18.4 GiB" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My laptop ran out of space again. Not from photos or videos. From build output.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;target/&lt;/code&gt; in every Rust crate. A &lt;code&gt;node_modules/&lt;/code&gt; in every web project. A &lt;code&gt;build/&lt;/code&gt; and &lt;code&gt;.dart_tool/&lt;/code&gt; in every Flutter app. None of it matters, and all of it comes back the next time I build. One scan of my code folder found 21.5 GB across 8 projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bash script that missed half of it
&lt;/h2&gt;

&lt;p&gt;For a while I used a small script. Walk the code folder, find a project marker (&lt;code&gt;Cargo.toml&lt;/code&gt;, &lt;code&gt;pubspec.yaml&lt;/code&gt;, &lt;code&gt;package.json&lt;/code&gt;), run the clean command, move on.&lt;/p&gt;

&lt;p&gt;The problem was "move on". The script stopped at the first marker it found. My Flutter apps have a Rust crate inside them (&lt;code&gt;rust/&lt;/code&gt;, for native code). The script ran &lt;code&gt;flutter clean&lt;/code&gt; on the app and never looked inside. The crate's &lt;code&gt;target/&lt;/code&gt; folder sat there, often bigger than the whole app.&lt;/p&gt;

&lt;p&gt;That is not Flutter's fault. &lt;code&gt;flutter clean&lt;/code&gt; should not touch a folder it does not own. The gap was in my script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not just rm -rf?
&lt;/h2&gt;

&lt;p&gt;Because guessing is how people lose work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some repos commit their &lt;code&gt;build/&lt;/code&gt; folder. Delete it and a rebuild will not bring it back.&lt;/li&gt;
&lt;li&gt;A folder called &lt;code&gt;target&lt;/code&gt; is not always Cargo's.&lt;/li&gt;
&lt;li&gt;A symlink can point somewhere you really did not mean to delete.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;cargo clean&lt;/code&gt; knows which files are Cargo's. A shell glob does not.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;So I wrote Kruftle, a small open source desktop app (Windows, macOS, Linux). It:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Scans a folder and finds every project, including projects nested inside other projects.&lt;/li&gt;
&lt;li&gt;Works out what each one is built with (50 toolchains: cargo, flutter, gradle, maven, go, dotnet, swift, mix and more) and whether that SDK is installed.&lt;/li&gt;
&lt;li&gt;Shows a dry run with a real measurement of what would be freed.&lt;/li&gt;
&lt;li&gt;Runs each toolchain's own clean command, in parallel, and reports what was actually freed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It only deletes a folder outright when the SDK is not installed, the folder name is on a per-toolchain allow list, and you tick a box for that run. It skips anything git tracks, never follows symlinks, and refuses to run on &lt;code&gt;/&lt;/code&gt; or your home folder.&lt;/p&gt;

&lt;p&gt;On that first scan it got back 18.4 GB of the 21.5 GB. The rest was in projects whose SDK I did not have, so it asked first.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The big folders are rarely where you expect. The nested ones were the worst.&lt;/li&gt;
&lt;li&gt;"Dry run, then measure what really happened" builds more trust than any warning dialog.&lt;/li&gt;
&lt;li&gt;Users of a cleanup tool give you one chance. Every safety rule above came from thinking about the one time it goes wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Code and downloads: &lt;a href="https://github.com/dizitart/kruftle?utm_source=devto&amp;amp;utm_medium=community" rel="noopener noreferrer"&gt;https://github.com/dizitart/kruftle?utm_source=devto&amp;amp;utm_medium=community&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How do you clean old build folders today: a script, a tool, or just wait for the disk full warning?&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>rust</category>
      <category>flutter</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
