diff --git a/filenamescramble.py b/filenamescramble.py index 5a938c4..d244db3 100644 --- a/filenamescramble.py +++ b/filenamescramble.py @@ -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) diff --git a/filenamescrambleint.py b/filenamescrambleint.py index 1ce3f6f..a2c72e7 100644 --- a/filenamescrambleint.py +++ b/filenamescrambleint.py @@ -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) diff --git a/filenamescrambleordered.py b/filenamescrambleordered.py index 46b87f9..11ad781 100644 --- a/filenamescrambleordered.py +++ b/filenamescrambleordered.py @@ -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)