Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from string import printable
- FILES_DIR = '/home/bandit4/inhere/'
- alphabet = printable + '\n'
- def is_valid_file(fn):
- with open(fn) as f:
- content = f.read()
- for ch in content:
- if ch not in alphabet:
- return False
- return True
- os.chdir(FILES_DIR)
- filenames = os.listdir('.')
- for fn in filenames:
- if is_valid_file(fn):
- print(FILES_DIR + fn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement