Created
June 16, 2013 13:47
-
-
Save elisee/5792112 to your computer and use it in GitHub Desktop.
A script to get rid of all .suo files (by renaming them to .suo.old) This is useful when Visual Studio decides to take a very long time to start or stop the debugger.
See https://connect.microsoft.com/VisualStudio/feedback/details/583539 for details about the bug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gets rid of all .suo files (by renaming them to .suo.old) | |
# This is useful when Visual Studio decides to take a very long time to start | |
# or stop the debugger. | |
# See https://connect.microsoft.com/VisualStudio/feedback/details/583539 for | |
# details about the bug | |
import os | |
suoFiles = [] | |
for root, dirs, files in os.walk('.'): | |
# Ignore special folders like .hg, .git or .svn | |
if "\\." in root or "/." in root: | |
continue | |
files = [ os.path.join( root, fi ) for fi in files if fi.endswith(".suo") ] | |
if len(files) > 0: | |
suoFiles.extend( files ) | |
for suoFile in suoFiles: | |
suffix = "" | |
while os.path.exists( suoFile + ".old" + suffix ): | |
if suffix == "": | |
suffix = "1" | |
else: | |
suffix = str( int(suffix) + 1 ) | |
os.rename( suoFile, suoFile + ".old" + suffix ) | |
print( str.format( "{0} .suo files renamed", len(suoFiles) ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment