Skip to content

Instantly share code, notes, and snippets.

@akinozgen
Last active June 23, 2020 21:18
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 akinozgen/792a3090a659152a395a0d41b0531c42 to your computer and use it in GitHub Desktop.
Save akinozgen/792a3090a659152a395a0d41b0531c42 to your computer and use it in GitHub Desktop.
Commands to organize downloaded mp3 files of spotdl (spotify downloader python package)

I don not recommending using it as bash script.

Commands:

  1. Store artist names to multi line text variable.

export list="$(ls *.mp3 | awk '{split($0,a," - "); print a[1]}' | uniq)"

  1. Check if names correct.

echo $list

  1. Create named directories from artist names variables.

echo "$list" | while IFS= read -r line ; do mkdir "$line"; done

  1. Move all mp3 files to their corresponding directories.

echo "$list" | while IFS= read -r line ; do mv $line*.mp3 $line/; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment