2019-06-12 05:41:31 +00:00
|
|
|
'''
|
|
|
|
Drag multiple files on top of this .py file. The first file will have its
|
2021-12-22 00:58:10 +00:00
|
|
|
name randomly scrambled into 12 digits. The others will increment that number
|
|
|
|
by 1.
|
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
|
|
|
|
|
2019-06-12 05:41:31 +00:00
|
|
|
argv = sys.argv[1:]
|
|
|
|
|
|
|
|
randname = [random.choice(string.digits) for x in range(12)]
|
|
|
|
randname = int(''.join(randname))
|
2021-09-24 06:42:34 +00:00
|
|
|
|
|
|
|
for path in pathclass.glob_many(argv):
|
|
|
|
newname = str(randname).rjust(12, '0') + path.dot_extension
|
|
|
|
randname += 1
|
|
|
|
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))
|