Created
May 9, 2012 01:23
-
-
Save wesleym/2640963 to your computer and use it in GitHub Desktop.
Prune empty directories in Subversion checkout
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
| import os | |
| swept = [] | |
| for root, dirs, files in os.walk('.', topdown=False): | |
| if root.find('/.svn/') > 0: continue | |
| if files: continue | |
| content = False | |
| for dir in dirs: | |
| if dir != '.svn' and os.path.join(root, dir) not in swept: | |
| content = True | |
| if content: continue | |
| os.system('svn delete ' + root) | |
| swept.append(root) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment