[TASK] Incremental increase of project folders if name already uses
This commit is contained in:
1 parent
8a306f0e33
commit
e31d5023b3
1 file changed
+6
-2
@@ -24,9 +24,13 @@ if not path.exists() and path.is_file() :
|
|||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|
||||||
for subpath in path.iterdir() :
|
while True :
|
||||||
if subpath.name == args.name :
|
checkablePath = args.name if counter == 0 else args.name + str(counter)
|
||||||
|
subpath = path.joinpath(checkablePath)
|
||||||
|
if subpath.exists() :
|
||||||
counter += 1
|
counter += 1
|
||||||
|
else :
|
||||||
|
break
|
||||||
|
|
||||||
if counter != 0 :
|
if counter != 0 :
|
||||||
path = Path(path.absolute().as_posix() + f"/{args.name}" + str(counter))
|
path = Path(path.absolute().as_posix() + f"/{args.name}" + str(counter))
|
||||||
|
|||||||
Reference in new issue
Block a user