Files
eagle0/scripts/rename_headshots.py
adminandGitHub 64b065b7c9 More headshots (#2989)
* add some more headshots

* more headshots

* rename headshots and upload more

* lots more
2023-10-19 22:13:48 -07:00

24 lines
792 B
Python
Executable File

#!/usr/bin/env python3
import os
import random
from datetime import date
base_directory = '/Users/dancrosby/Documents/headshots/no_profession/'
directories = [f'{base_directory}male/', f'{base_directory}female/']
counter = 1
date_str = date.today().strftime('%Y%m%d')
for directory in directories:
for filename in os.listdir(directory):
orig_path = os.path.join(directory, filename)
if os.path.isfile(orig_path) and filename.endswith('.png') and 'photorealistic_headshot' in filename:
new_filename = f'{date_str}_{counter}_{random.randint(0, 99999999999)}.png'
counter = counter + 1
new_path = os.path.join(directory, new_filename)
print(f'moving {orig_path} to {new_path}')
os.rename(orig_path, new_path)