Use pathclass.natural_sorter.
This commit is contained in:
parent
2318b978c9
commit
b762a2d3e8
3 changed files with 3 additions and 3 deletions
|
@ -12,7 +12,7 @@ from voussoirkit import pathclass
|
||||||
|
|
||||||
argv = sys.argv[1:]
|
argv = sys.argv[1:]
|
||||||
|
|
||||||
for path in pathclass.glob_many(argv):
|
for path in sorted(pathclass.glob_many(argv), key=pathclass.natural_sorter):
|
||||||
newname = [random.choice(string.ascii_lowercase) for x in range(9)]
|
newname = [random.choice(string.ascii_lowercase) for x in range(9)]
|
||||||
newname = ''.join(newname) + path.dot_extension
|
newname = ''.join(newname) + path.dot_extension
|
||||||
newname = path.parent.with_child(newname)
|
newname = path.parent.with_child(newname)
|
||||||
|
|
|
@ -12,7 +12,7 @@ from voussoirkit import pathclass
|
||||||
|
|
||||||
argv = sys.argv[1:]
|
argv = sys.argv[1:]
|
||||||
|
|
||||||
for path in pathclass.glob_many(argv):
|
for path in sorted(pathclass.glob_many(argv), key=pathclass.natural_sorter):
|
||||||
newname = [random.choice(string.digits) for x in range(12)]
|
newname = [random.choice(string.digits) for x in range(12)]
|
||||||
newname = ''.join(newname) + path.dot_extension
|
newname = ''.join(newname) + path.dot_extension
|
||||||
newname = path.parent.with_child(newname)
|
newname = path.parent.with_child(newname)
|
||||||
|
|
|
@ -16,7 +16,7 @@ argv = sys.argv[1:]
|
||||||
randname = [random.choice(string.digits) for x in range(12)]
|
randname = [random.choice(string.digits) for x in range(12)]
|
||||||
randname = int(''.join(randname))
|
randname = int(''.join(randname))
|
||||||
|
|
||||||
for path in pathclass.glob_many(argv):
|
for path in sorted(pathclass.glob_many(argv), key=pathclass.natural_sorter):
|
||||||
newname = str(randname).rjust(12, '0') + path.dot_extension
|
newname = str(randname).rjust(12, '0') + path.dot_extension
|
||||||
randname += 1
|
randname += 1
|
||||||
newname = path.parent.with_child(newname)
|
newname = path.parent.with_child(newname)
|
||||||
|
|
Loading…
Reference in a new issue