Skip to content

Instantly share code, notes, and snippets.

@johnjosephhorton
Created May 15, 2012 00:28
Show Gist options
  • Save johnjosephhorton/2698276 to your computer and use it in GitHub Desktop.
Save johnjosephhorton/2698276 to your computer and use it in GitHub Desktop.
Makes sure there are no unsaved files
def hashfree(input_dir):
"""Makes sure---before we start doing lots of intense computations---that
there are not any files w/ hash in front of them (which the shutil utility
cannot copy for some reason) """
no_bad_files = True
bad_files = []
for root, subFolders, files in os.walk(input_dir):
for f in files:
if re.search('\.#.*', f):
no_bad_files = False
bad_files.append(f)
return (no_bad_files, bad_files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment