Skip to content

Instantly share code, notes, and snippets.

@bsmithyman
Created December 5, 2014 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsmithyman/18d9f601bd3068b6533e to your computer and use it in GitHub Desktop.
Save bsmithyman/18d9f601bd3068b6533e to your computer and use it in GitHub Desktop.
Remove conflicted Dropbox files from a directory
import os
def findMatches(source, substr):
matches = []
for root, dirnames, filenames in os.walk(source):
for filename in filenames:
if filename.find(substr) > -1:
matches.append(os.path.join(root, filename))
return matches
matches = findMatches('/Users/brendan/Dropbox/something', 'Brendan Smithyman\'s conflicted copy')
for match in matches:
print(match)
os.remove(match)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment