I'm trying to write a code to sort photos by file date to new monthly folders, but I cant.
Code:
from pathlib import Path
from datetime import datetime
import os
our_files = Path(r"C:\Users\dovyd\OneDrive\Desktop\testas")
for file in our_files.iterdir(): 
    if file.is_file() and file.stem != '.DS_Store':
        directory = file.parent
        extension = file.suffix
        
        old_name = file.stem
        region, report_type, old_date = old_name.split('-')
        
        old_date = datetime.strptime(old_date, '%Y%b%d')
        date = datetime.strftime(old_date, '%Y-%b-%d')
        
        new_file = f'{date} - {region}  {report_type}{extension}'
        
        month = datetime.strftime(old_date, "%B")
        new_path = our_files.joinpath(month)
        
        if not new_path.exists():
            new_path.mkdir()
            
        new_file_path = new_path.joinpath(new_file)
        
        
        file.replace(new_file_path)
Error:
File "...\AAAA.py", line 14, in <module>
    region, report_type, old_date = old_name.split('-')
ValueError: not enough values to unpack (expected 3, got 1)
 
     
    