Community post
Clean disk space by removing bin, obj, packages folders generated by Visual Studio
Introduction
I am using PowerShell every day.
I thought it will be nice to share some of my scripts with other people.
That's why I've created PowerShellLibrary
Script
When using Visual Studio and building solution we generate bin, obj folders with output files. In addition, if you are using Nuget there will be packages folder created in the solution root with downloaded dlls.
If you have many projects on your disk which at some point you've build and you are no longer using them actively free disk space is occupied without any reason.
To clean all those folders and free disk space I've written following script
remove-bin-obj-packages-folders-for-given-path.ps1
Usage
At the bottom, there is an example.
You have to invoke Clear-VisualStudioProjectFolder cmdlet and pass start path (folder which will be searched for Visual Studio projects files.
Clear-VisualStudioProjectFolder "C:\repo\"
After you do this you will see a report
FullName LastWriteTime Size [MB]
-------- ------------- ---------
C:\repo\ProofOfConcept\ProofOfConcept.Test\obj 17-Dec-17 4:52:47 PM 0.00
C:\repo\ProofOfConcept\ProofOfConcept\obj 17-Dec-17 4:52:47 PM 0.00
C:\repo\powershellgallery\mod3\ISESteroids\2.7.1.7\WPF\WPFDesigner\obj 17-Dec-17 4:52:47 PM 0.00
C:\repo\ExtendedPersonalization\ExtendedPersonalization\obj 17-Dec-17 4:42:45 PM 0.01
C:\repo\ExtendedPersonalization\ExtendedPersonalization\bin 17-Dec-17 4:42:45 PM 0.00
Memory to release 0.01 MB
WARNING: If you type 'Y', all folders listed above will be moved removed.
Are you Sure You Want To Proceed:
Type Y and press enter to clean those folders. In case there is nothing to clean, script will finish work without additional prompts.
Posted on Utopian.io - Rewarding Open Source Contributors
Replies (5)
Congratulations @alan-null! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOPThank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @alan-null I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Congratulations @alan-null! You received a personal award!
Click here to view your Board of Honor
Do not miss the last post from @steemitboard:
Congratulations @alan-null! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!