Skip to content

Instantly share code, notes, and snippets.

@ehough
Created August 27, 2014 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehough/e3fb6687690a495cadef to your computer and use it in GitHub Desktop.
Save ehough/e3fb6687690a495cadef to your computer and use it in GitHub Desktop.
mp3 copier for head unit
dest_base="destination"
src_dir="src/"
atfile=0
atdir=0
for file in $src_dir/*; do
if ((atfile == 0)); then
dest_dir=$(printf "$dest_base/%0.5d" $atdir)
[[ -d $dest_dir ]] || mkdir -p $dest_dir
fi
cp $file $dest_dir
((atfile++))
if ((atfile > 99)); then
atfile=0
((atdir++))
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment