2019-06-12 05:41:31 +00:00
|
|
|
'''
|
|
|
|
Drag a file on top of this .py file, and it will have its
|
2020-02-06 05:48:37 +00:00
|
|
|
filename scrambled into a combination of upper and lowercase letters.
|
2019-06-12 05:41:31 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
import os
|
|
|
|
import random
|
|
|
|
import string
|
|
|
|
import sys
|
|
|
|
|
2020-02-06 05:48:37 +00:00
|
|
|
from voussoirkit import pathclass
|
|
|
|
from voussoirkit import winglob
|
|
|
|
|
2019-06-12 05:41:31 +00:00
|
|
|
argv = sys.argv[1:]
|
2020-02-06 05:48:37 +00:00
|
|
|
|
|
|
|
for pattern in argv:
|
|
|
|
for path in winglob.glob(pattern):
|
|
|
|
path = pathclass.Path(path)
|
|
|
|
newname = [random.choice(string.ascii_lowercase) for x in range(9)]
|
|
|
|
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))
|