Skip to content

Instantly share code, notes, and snippets.

@aahnik
Created November 30, 2022 10:43
Show Gist options
  • Save aahnik/cae1934bfca9077cddadec3349a9c9a0 to your computer and use it in GitHub Desktop.
Save aahnik/cae1934bfca9077cddadec3349a9c9a0 to your computer and use it in GitHub Desktop.
Python Script to add suffix to all your files
import os
SUFFIX = "S20220010001" # replace with your suffix
for item in os.listdir():
fname, ext = item.split(".")
if not fname.endswith(SUFFIX):
fname += f"_{SUFFIX}"
os.rename(item, fname + "." + ext)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment