I have an MP3 speaker that I wanted to use as a dead simple lullaby station for my daughter. The idea is to have several copies of a set of lullabies so that you can just hit play and have hours of lullaby keep playing.
The lullaby I got was an MP3 album from Amazon. To make the copies, the following shell command did the job:
[code language="bash"]
# Make a bunch of copies in a new directory tmp. If tmp exists, it will be bad.
# Exercise for reader: use mktemp to create a temp directory.
mkdir tmp
for f in *.mp3; do
for ii in {0..9}; do
# Create files with random prefix
ln $f tmp/${RANDOM}_$f
done
done
#
for f in $(shuf -e tmp/*.mp3); do
cp $f /mnt/sdcard
done
rm -r tmp
[/code]
shuf doesn't exist on macOS. You can use gshuf from Homebrew coreutils. Or you could use this instead, if you don't want Homebrew:
[code language="bash"]
mkdir tmp
for f in *.mp3; do
for ii in {0..9}; do
# Create files with random prefix
ln $f tmp/${RANDOM}_$f
done
done
for f in $(echo tmp/*.mp3 | /usr/bin/perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);'); do
# change the /Volumes path to you sdcard or USB drive mount path
cp $f /Volumes/UNTITLED
done
rm -r tmp
[/code]