ensure that folder names are also sorted naturally
- ID
f344649- date
2023-08-03 09:29:17+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
4b53a22- message
ensure that folder names are also sorted naturally- changed files
1 file, 4 additions, 2 deletions
Changed files
aws/s3tree.py (6239) → aws/s3tree.py (6274)
diff --git a/aws/s3tree.py b/aws/s3tree.py
index 0161d0f..bafd1e7 100755
--- a/aws/s3tree.py
+++ b/aws/s3tree.py
@@ -137,9 +137,11 @@ def pprint_s3tree(*, bucket, tree):
extra_objects = f"...{len(tree.objects) - 3} other objects"
lines.append(f"{prefix_char} {termcolor.colored(extra_objects, 'blue')}")
- for i, (folder_name, folder_tree) in enumerate(
- sorted(tree.folders.items()), start=1
+ for i, folder_name in enumerate(
+ natsort.natsort(tree.folders), start=1
):
+ folder_tree = tree.folders[folder_name]
+
if tree.path == "":
full_path = folder_name
else: