Skip to content

Instantly share code, notes, and snippets.

View cgranier's full-sized avatar

Carlos Granier cgranier

View GitHub Profile
@cgranier
cgranier / move_images.py
Last active June 19, 2024 21:54
Traverse directories and move all image files (jpg, png, gif) to an "images" directory under the current location
import os
import shutil
def move_images(source_directory, target_directory):
# Create the target directory if it doesn't exist
if not os.path.exists(target_directory):
os.makedirs(target_directory)
for root, _, files in os.walk(source_directory):
for file in files:
@cgranier
cgranier / thumbnail_cleaner.py
Created June 19, 2024 21:51
Traverse directories, identify the thumbnail images and their corresponding original images, and perform either a dry run or a hot run to delete the thumbnails
import os
import argparse
def find_thumbnails(directory):
thumbnails = []
for root, _, files in os.walk(directory):
for file in files:
if file.endswith(".thumbnail.png") or file.endswith(".thumbnail.jpg"):
original_file = file.replace(".thumbnail", "")
if original_file in files:

Keybase proof

I hereby claim:

  • I am cgranier on github.
  • I am cgranier (https://keybase.io/cgranier) on keybase.
  • I have a public key ASBnxdq2pJnHW-vkYGgZgrYIYqa_KSIt7ugQ9sny5bzuJgo

To claim this, I am signing this object:

@cgranier
cgranier / README.md
Created October 12, 2013 15:00 — forked from nikcub/README.md