Hello. I try to write command to rename parrent folder.
Field: _DIRECTORY
Format string: [%comment%] %artist% - %album% (%year%)
Folder must look: [comment] artist - album (year).
Result whithout []: comment artist - album (year). Maybe [] - special symbols and they must be shielded?
Yes, try:
Format string: '['%comment%']' %artist% - %album% (%year%)
The square brackets serve as "if" condition and designate the part that should only be output if the tag field exists.
See also the documentation:
I think you mean the folder and not the parent-folder.
You should take 2 things into consideration:
-
An action for the pseudo-tagfield _DIRECTORY moves all files of a folder to a new directory, not only the marked ones. The content of the first marked file will be responsible where you move all the files in the folder.
-
If COMMENT is empty you will end up with "[] " before %album%. If this could be a problem use the format string:
['['%comment%']' ]%artist% - %album% (%year%)
. This makes use of the mentioned "if" condition of square brackets.
Thank you for information. Also today I needed to copy part of parent folder ("Catalog number of release" inside the square brackets) to tag and after few tries wrote this command,:
$regexp(%_DIRECTORY%,'^\[(.*?)\].*(\(\d{4})\)$','$1')
Folder name: [Catalog number of release] Artist - Album (year)
Good morning. Again, the problem with square brackets.
I need import the numbers at the end of the folder name to tag
First I tried Filename->Tag
Format string:
%dummy% (%dummy%) %AlbumID%\%_filename%
It work well, when folder name is: [] Artist - Album (Year) 43673771
Result: 43673771
But if folder name is: [] Artist - Album (Another artist remix) (Year) 43673771
then result is: (Year) 43673771
Second I tried action "Guess values" with regexp:
Source format: $regexp(%_DIRECTORY%, '.*\(\d{4}\) (.*)', '$1')
Guessing pattern: %AlbumID%
or "Format value":
Field: ALBUMID
Format string: $regexp(%_DIRECTORY%, '.*\(\d{4}\) (.*)', '$1')
In both cases result is: [] 43673771
I can't understand where the square brackets come from as a result
I tried shield it:
$regexp(%_DIRECTORY%, '^'['']'.*\(\d{4}\) (.*)', '$1')
But it dont work.
I cannot reproduce it:
$regexp([] Artist - Album (Another artist remix) (2000) 43673771, '.*\(\d{4}\) (.*)', '$1')
leads to:
" 43673771"
(with 2 extra space characters in front coming from the spaces following the commas)
Yes, mistake was in those 2 spaces after commas and before apostrophes.
Now this works well:
$regexp(%_DIRECTORY%,'.*\(\d{4}\) (.*)','$1')
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.