2020-02-06 05:48:37 +00:00
|
|
|
'''
|
|
|
|
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:]
|
|
|
|
|
2022-08-21 21:48:42 +00:00
|
|
|
for path in sorted(pathclass.glob_many(argv), key=pathclass.natural_sorter):
|
2021-09-24 06:42:34 +00:00
|
|
|
newname = [random.choice(string.digits) for x in range(12)]
|
|
|
|
newname = ''.join(newname) + path.dot_extension
|
|
|
|
newname = path.parent.with_child(newname)
|
2021-12-03 03:34:28 +00:00
|
|
|
os.rename(path, newname)
|
2021-09-24 06:42:34 +00:00
|
|
|
print('%s -> %s' % (path.absolute_path, newname.basename))
|