Skip to content

Instantly share code, notes, and snippets.

@wesleym
Created May 9, 2012 01:23
Show Gist options
  • Select an option

  • Save wesleym/2640963 to your computer and use it in GitHub Desktop.

Select an option

Save wesleym/2640963 to your computer and use it in GitHub Desktop.
Prune empty directories in Subversion checkout
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