I have a bash script that goes through my music folder, gets all the song metadata with mediainfo and is intended to make folders out of all the artists' names, but it fails.
This is the code so far:
#!/bin/bash cd Music/ for i in "$(ls -b | grep -v /)"; do info=$(mediainfo $i) artist=$(echo "$info" | grep "^Performer" | awk '{for(i=3;i<=NF;++i)printf $i""FS ; print ""}') mkdir "$artist" done For some reason, it seems to go through all the songs first and then tries to make a directory with all their names combined; my intent is to create a directory for the performer found by Mediainfo in each music file.