Skip to content

Instantly share code, notes, and snippets.

@xErik
Last active July 29, 2019 12:37
Show Gist options
  • Save xErik/d5938cc352b1d3d5afea538563d4554b to your computer and use it in GitHub Desktop.
Save xErik/d5938cc352b1d3d5afea538563d4554b to your computer and use it in GitHub Desktop.
Combine multiple MP3 files from multiple folders into an audiobook
#!/bin/bash
# Requires http://mp3wrap.sourceforge.net/
# Require rename
# Correct sorting for me, NOT: 1, 10, 11, 2 ,...
# Names the MP3 to current directory name
# Replaces whitespace in file and folder names by single underscore
# This script is usefull if your direcorie names are like: VCD_2019_7_26_(1), VCD_2019_7_26_(2), ...
# This script is usefull if your direcorie names are like: _title_.mp3, _title_ (1).mp3, _title_ (2).mp3, ...
find . -depth -name "* *" -execdir rename 's/ /_/g' "{}" \;
find . -name '*.mp3'|sort -V|xargs mp3wrap $(basename $PWD | sed 's/\ /_/g').mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment