Easily Clean Bin/Obj Folders
In an earlier blog post I talked about how to clean up space on your Xamarin Developer machine by deleting old installations, NuGet cache, and Android junk sitting around. We can take it one step further and delete all of that clutter that is built up in the bin/obj folders! This can be gigs of data. Here is my GitHub folder:
Inside of each of my repo folders sits code and the bin/obj folders from each build, which can be very large as it contains the full excecutable. What we can do is write a simple powershell script on Windows to recursively delete all of those nasty folders.
Boot up powershell in admin mode and **_navigate to the root of your repos.
THIS IS VERY IMPORTANT: DO NOT RUN THIS COMMAND IN A SYSTEM FOLDER OR TERRIBLE THINGS WILL HAPPEN.
I am serious about this, make sure you do this in a sub folder. Mine is C:\GitHub.
Then run this command:
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
Now we can check that folder size again:
Amazing! Removed 10GB of build up! Amazing! Looking to do it on macOS? Check this guide from Joe Sauve.