My music is sorted in folders named 'artist - album' (eg: ACDC - Back In Black). I would like to be able to select a bunch of folders and run a script that will move them to folders named after the artist portion of the folder name (eg: ACDC - Back In Black would move to a folder named ACDC).
I have this script that moves selected files to folders named after each of the files:
Code: Select all
end(getinfo("CountSelected") < 1), "Nothing selected!";
foreach($file, get("SelectedItemsPathNames", "|"), "|") {
$baseName = getpathcomponent($file, "base");
moveto "<curpath>\$baseName", "$file", , 2;
}
Code: Select all
end(getinfo("CountSelected") < 1), "Nothing selected!";
foreach($folder, get("SelectedItemsPathNames", "|"), "|") {
$baseName = getpathcomponent($folder, "base");
$artistName = $baseName before hyphen
moveto "<curpath>\$artistName", "$folder", , 2;
}
Thanks in advance for any help.