From Directory to month number folder and vice versa
Below is a Python script that will analyze the creation date of images in a specified directory, create a folder for each month (using the month number), and move the images to the corresponding month folder. import os import shutil from datetime import datetime from PIL import Image from PIL.ExifTags import TAGS def get_image_month(image_path): try: image = Image.open(image_path) exif_data = image._getexif() if exif_data: for tag, value in exif_data.items(): if TAGS.get(tag) == 'DateTimeOriginal': date_taken = datetime.strptime(value, '%Y:%m:%d %H:%M:%S') return date_taken.month except Exception as e: print(f"Error getting EXIF data for {image_path}: {e}") return None def organize_images_by_month(source_folder): if not os.path.exists(source_folder): print(f"Source folder '{source_folder}' does not exist.") ret