Skip to content

Instantly share code, notes, and snippets.

@anachronic
Created May 18, 2017 22:58
Show Gist options
  • Save anachronic/0a15ba45e50bacb69f27102778fdc7e2 to your computer and use it in GitHub Desktop.
Save anachronic/0a15ba45e50bacb69f27102778fdc7e2 to your computer and use it in GitHub Desktop.
import os
whitelist = ('a', 'b', 'c.ext', '.gitignore')
curpath = os.getcwd()
for file in os.listdir(curpath):
if file not in whitelist:
os.remove(os.path.join(curpath, file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment