Created
January 31, 2026 05:36
-
-
Save pjobson/1bcf414fb1e5c3019e72bffce02e416e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| SRC_DIR="$1" | |
| DEST_DIR="$2" | |
| if [ -z "$SRC_DIR" ] || [ -z "$DEST_DIR" ]; then | |
| echo "Usage: $0 <source_dir> <dest_dir>" | |
| exit 1 | |
| fi | |
| mkdir -p "$DEST_DIR" | |
| find "$SRC_DIR" -type f -name "*.mp3" -print0 | | |
| while IFS= read -r -d '' file; do | |
| RAND_STR=$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1) | |
| FILENAME=$(basename "$file") | |
| cp "$file" "$DEST_DIR/${RAND_STR} - ${FILENAME}" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment