Skip to content

Instantly share code, notes, and snippets.

@greencoder
greencoder / copy.py
Last active January 18, 2023 22:38
Randomly copy MP3 files to a new directory until the target directory reaches a certain file size
import pathlib
import random
import shutil
mp3_files = list(pathlib.Path('/Users/scott/Desktop/Music').rglob('*.mp3'))
dst_dir = pathlib.Path('/Users/snewman/Desktop/CopiedMusic')
TARGET_SIZE = 1979999999
for x in range(0, len(mp3_files)):