Hi, so in SongKong and Jaikoz we split the filepath into three parts
- Base Folder
- Sub Folder
- Filename
In your first example the Base Folder is X:\Sort\SK Test, the Sub Folder is [1966] Revolver (1966 Parlophone PCS 7009 Original UK Tube Cut Stereo Pressing) [24-96], you dont show filename but lets assume it would be something like 01 - Taxman.wav
The Rename Files task can use a filename mask to replace the values of SubFolder and Filename, you can also configure to Rename filename part Only to only replace the Filename, but we dont currently have the option to Rename Subfolder Only which is what you ideally want.
Your request is an unusual one because usually new filepaths are constructed purely from metadata within the file, this ensures they are consistently named. But in your case you would like keep the album and filename component of the existing filepath but insert a folder based on albumartist/artist, and I can see why because you have alot of information encoded in the album part of the filename.
I had a go at creating filename mask in Preferences:Filename Masks that could be used by Filename Renamer as follows
function filepathFilenameComponent()
{
var file = filename.substring(filename.lastIndexOf('/') + 1);
return file;
}
function filepathAlbumComponent()
{
var subFolderPath = filename.substring(0, filename.lastIndexOf('/'));
var albumComponent = subFolderPath.substring(subFolderPath.lastIndexOf('/') + 1);
return albumComponent;
}
ifnotempty2(albumartist, artist,'/') + filepathAlbumComponent() + "/" + filepathFilenameComponent();
Note we use ‘/’ to specify a folder seperator on both Windows and Unix so that masks work on either system, but on Windows the ‘/’ is converted to ‘\’ behind the scenes.
Unfortunately there is an issue, when metadata fields are extracted from the file we clean the value, this means that occurrences of / and \ are replaced with ’ - '. This makes sense for metadata values because if metadata contains slash (e.g AC/DC) we dont want use of that value to split into two folders, but when parsing filename we need to know where the separators are.
So this rename mask does not work, it runs if you replace filename.lastIndexOf(’/’) with filename.lastIndexOf(’ - ')
function filepathFilenameComponent()
{
var file = filename.substring(filename.lastIndexOf(' - ') + 1);
return file;
}
function filepathAlbumComponent()
{
var subFolderPath = filename.substring(0, filename.lastIndexOf(' - '));
var albumComponent = subFolderPath.substring(subFolderPath.lastIndexOf(' - ') + 1);
return albumComponent;
}
ifnotempty2(albumartist, artist,'/') + filepathAlbumComponent() + "/" + filepathFilenameComponent();
but the trouble with this method is if the filepath already contains ’ - ’ such as if the filename was 01 - Taxman.wav this gets picked up instead and you end up with splitting the album
So I have raised a bug to fix this https://jthink.atlassian.net/browse/SONGKONG-2648 for next release, should be within a few weeks.
The alternative is to use a standard rename mask constructed from songs metadata , you can also use metadata from matching MusicBrainz/Discogs release if the songs have been matched to these. This should be able to generate something similar to your existing album component if not exactly the same.
e.g basic example to give some idea (doesnt check for empty values ectera)
ifnotempty2(albumartist,artist,'/')
+ ifnotempty(mb_release
+ '('
+ mb_release_year + ' '
+ mb_comment
+ ')'
+ '['
+ audioformat + ' '
+ audiobitrate
+ ']'
+ '{'
+ mb_catno
+ '}'
,'/')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title