This commit is contained in:
2026-06-30 15:13:52 -07:00
parent 2c0d01704f
commit 1ee7d7210a
2 changed files with 15 additions and 6 deletions

View File

@@ -422,8 +422,11 @@ def main():
while new_path.exists():
new_path = old_path.with_name(f"{stem}_{counter}{old_path.suffix}")
counter += 1
old_path.rename(new_path)
renamed += 1
try:
old_path.rename(new_path)
renamed += 1
except FileNotFoundError:
print(f" SKIPPED (not found): {old_path.name}")
print(f" Renamed {renamed} file(s).")
else:
renamed = 0
@@ -487,7 +490,10 @@ def main():
while np.exists():
np = p.with_name(f"{stem}_{counter}{p.suffix}")
counter += 1
p.rename(np)
try:
p.rename(np)
except FileNotFoundError:
print(f" SKIPPED (not found): {p.name}")
renamed += len(items) - i
break
else:
@@ -505,8 +511,11 @@ def main():
new_path = old_path.with_name(f"{stem}_{counter}{old_path.suffix}")
counter += 1
print(f" (file existed, saved as {new_path.name})")
old_path.rename(new_path)
renamed += 1
try:
old_path.rename(new_path)
renamed += 1
except FileNotFoundError:
print(f" SKIPPED (not found): {old_path.name}")
i += 1
print(f"\n Renamed: {renamed} Skipped: {skipped}")