Created
May 4, 2025 11:20
-
-
Save 0xdeadbeer/ccebd5948a14d4af59bdff1c07c0d2d6 to your computer and use it in GitHub Desktop.
Rename from yt-dlp ugly naming convention to snake_case
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
#!/usr/bin/bash | |
for file in ./*.mp3 | |
do | |
new_file=$(echo "$file" | sed 's/\.\///g' | sed 's/\[[^]]*\]//g' | sed 's/([^)]*)//g' | sed 's/\.[^.]*$//g' | sed 's/[^a-zA-Z :]//g' | awk '{$1=$1;print}' | sed 's/ /_/g' | tr '[:upper:]' '[:lower:]' | sed 's/$/.mp3/g') | |
echo "old file name: '$file'" | |
echo "new file name: '$new_file'" | |
echo "" | |
mv "$file" "$new_file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment