Skip to content

Instantly share code, notes, and snippets.

@star-bits
Last active January 10, 2024 11:49
Show Gist options
  • Save star-bits/f7250dc0af18fb2daee6ed074ff043c5 to your computer and use it in GitHub Desktop.
Save star-bits/f7250dc0af18fb2daee6ed074ff043c5 to your computer and use it in GitHub Desktop.
Collect Nintendo Switch screenshot files into one folder
import os
import glob
import shutil
def collect_files(root_dir, target_dir):
if not os.path.exists(target_dir):
os.makedirs(target_dir)
# Find all .jpg and .mp4 files in the subdirectories
for extension in ['jpg', 'mp4']:
for filepath in glob.iglob(root_dir + '**/**/*.{}'.format(extension), recursive=True):
shutil.copy2(filepath, target_dir)
root_dir = '/Users/username/your/screenshots/folder' # Replace with your screenshots directory path
target_dir = '/Users/username/your/destination/folder' # Replace with your destination directory path
collect_files(root_dir, target_dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment