Last active
January 10, 2024 11:49
-
-
Save star-bits/f7250dc0af18fb2daee6ed074ff043c5 to your computer and use it in GitHub Desktop.
Collect Nintendo Switch screenshot files into one folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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