I have a Visual Studio solution with several projects. I clean up the bin and obj folders as part of clean up using the following script.
Get-ChildItem -path source -filter obj -recurse | Remove-Item -recurse
Get-ChildItem -path source -filter bin -recurse | Remove-Item -recurse
This works perfectly. However, I have a file-based data folder that has about 600,000 sub folders in it and is located in a folder called FILE_DATA.
The above script takes ages because it goes through all these 600,000 folders.
I need to avoid FILE_DATA folder when I recursively traverse and remove bin and obj folders.