Microplastic / CV-Project /preprocess.py
sharifahmed's picture
Upload 13 files
5dbe8b0 verified
Raw
History Blame Contribute Delete
521 Bytes
import os
folder_path = r'D:\Microplastic_data'
files = os.listdir(folder_path)
files.sort()
count = 1
for filename in files:
if filename.lower().endswith(".jpg"):
new_name = f"microplastic_{count}.jpg"
old_file = os.path.join(folder_path, filename)
new_file = os.path.join(folder_path, new_name)
os.rename(old_file, new_file)
print(f"Renamed: {filename} -> {new_name}")
count += 1
print(f"\nDone!: Successfully renamed {count - 1} files.")