Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from __future__ import unicode_literals, print_function
- import os
- import sys
- keep_same = [
- # Add the file types here you don't want to change.
- '.zip', '.tar',
- ]
- if len(sys.argv) < 2:
- print('provide path')
- for d in sys.argv[1:]:
- if os.path.isdir(d):
- for root, dirs, files in os.walk(d):
- for fn in files:
- if not any(fn.endswith(ext) for ext in keep_same):
- s = os.path.join(root, fn)
- os.rename(s, s + '.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement