cmd/filenamescrambleint.py
Ethan Dalool 4a9051e617
Big migrations and linting.
With pathclass.glob_many, we can clean up and feel more confident
about many programs that use pipeable to take glob patterns.

Added return 0 to all programs that didn't have it, so we have
consistent and explicit command line return values.

Other linting and whitespace.
2021-09-23 23:42:45 -07:00

20 lines
546 B
Python

'''
Drag a file on top of this .py file, and it will have its
filename scrambled into a combination of 12 digits.
'''
import os
import random
import string
import sys
from voussoirkit import pathclass
argv = sys.argv[1:]
for path in pathclass.glob_many(argv):
newname = [random.choice(string.digits) for x in range(12)]
newname = ''.join(newname) + path.dot_extension
newname = path.parent.with_child(newname)
os.rename(path.absolute_path, newname.absolute_path)
print('%s -> %s' % (path.absolute_path, newname.basename))