Skip to content

Instantly share code, notes, and snippets.

@keeb-zz
Created March 13, 2011 02:10
Show Gist options
  • Save keeb-zz/867801 to your computer and use it in GitHub Desktop.
Save keeb-zz/867801 to your computer and use it in GitHub Desktop.
walking a tree
import os
folder = '/path/to/folder'
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
except Exception, e:
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment