Quick tip today. I wanted to find all directories with a certain name specifically .vs because I wanted to delete them.

Is the .vs directory safe to delete? Yes, becuase its all generated files by VS that can be deleted. There is also db files in there that intellisense keeps, which can clutter your system after a while.

To find all files:

gci -recurse -Force -filter ".vs"
  • gci alias for GetChild-Item
  • -recurse to search all sub-directories
  • -Force to search hidden and system files (this is useful for .vs directory because it is typically hidden)
  • -filter to filter which directory or file we want

To get the full path of each result:

gci -recurse -Force -filter ".vs" | Select FullName

which will result in something like:

C:\proj\.vs\
C:\another-proj\.vs\
...

Now we can delete those directories.