Use pathclass.natural_sorter.

This commit is contained in:
voussoir 2022-08-21 14:48:42 -07:00
parent 2318b978c9
commit b762a2d3e8
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
3 changed files with 3 additions and 3 deletions

View file

@ -12,7 +12,7 @@ from voussoirkit import pathclass
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 = ''.join(newname) + path.dot_extension
newname = path.parent.with_child(newname)

View file

@ -12,7 +12,7 @@ from voussoirkit import pathclass
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 = ''.join(newname) + path.dot_extension
newname = path.parent.with_child(newname)

View file

@ -16,7 +16,7 @@ argv = sys.argv[1:]
randname = [random.choice(string.digits) for x in range(12)]
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
randname += 1
newname = path.parent.with_child(newname)