From e31d5023b3cd1312d0da59a868362a7901a78cc6 Mon Sep 17 00:00:00 2001 From: Kaito Date: Thu, 17 Sep 2026 17:38:55 +0200 Subject: [PATCH] [TASK] Incremental increase of project folders if name already uses --- lpp.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lpp.py b/lpp.py index bb4938a..0752ec8 100644 --- a/lpp.py +++ b/lpp.py @@ -24,9 +24,13 @@ if not path.exists() and path.is_file() : counter = 0 -for subpath in path.iterdir() : - if subpath.name == args.name : +while True : + checkablePath = args.name if counter == 0 else args.name + str(counter) + subpath = path.joinpath(checkablePath) + if subpath.exists() : counter += 1 + else : + break if counter != 0 : path = Path(path.absolute().as_posix() + f"/{args.name}" + str(counter))