I have a directory set up that stores *.mp3 files.
I need to read the filename of the files, create a directory with only the artist's name and move the *.mp3 file into the new directory. I want to read in the filename from the beginning all the way up to the hyphen.
Filename: Black Sabbath - Crazy Train.mp3
New directory: Black Sabbath
Read filename up to hyphen "Black Sabbath " then Make directory "Black Sabbath"
Move "Black Sabbath - Crazy Train.mp3" to directory "Black Sabbath"
I sort of modified some script from a closely related question on here, but it doesn't exclude the hyphen and everything after it when naming the directory. In addition, even if it did exclude the hyphen and so on, I fear the program would not be successful in moving the file to the new directory since the names would not completely match. Anyone know how to do this? Thanks.