mission17-ai / scripts /data_prep /fix_dataset.py
GitHub Action
sync: ci: trigger initial deploy to Hugging Face
27dc85b
Raw
History Blame Contribute Delete
1.01 kB
import os
import shutil
# Define paths
import os
base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'dataset', 'garbage_classification')
old_planting = os.path.join(base_dir, "planting")
new_planting = os.path.join(base_dir, "SDG13_15_Planting")
# Create new folder if it doesn't exist
if not os.path.exists(new_planting):
os.makedirs(new_planting)
# Move files from Old -> New
if os.path.exists(old_planting):
print(f"๐Ÿ”„ Moving files from '{old_planting}' to '{new_planting}'...")
files = os.listdir(old_planting)
for file in files:
old_path = os.path.join(old_planting, file)
new_path = os.path.join(new_planting, f"old_{file}") # Rename to avoid conflicts
shutil.move(old_path, new_path)
# Delete the empty old folder
os.rmdir(old_planting)
print("โœ… Successfully merged folders!")
print("๐Ÿ—‘๏ธ Deleted old 'planting' folder.")
else:
print("โš ๏ธ Old 'planting' folder not found. Already merged?")