How to rename my folder

Hello, how to rename(reappoint) my file following the code: %artist% ~ %album%, but if the name of the album is empty I want that my file is renamed only like that: %artist%

To rename a folder (not file)
you can apply an action of the type "Format tag field" for _DIRECTORY
Format string: %artist%[ ~ %album%]

The square brackets enclose an optional part that is only used if the referenced field is filled with data.

Use the converter Tag - Filename and the format string

$if(%album%,%artist% ~ %album%,%artist%)

But I can't see any sense in naming mp3-files only by "artist - album" or even worse by only "artist".
There will be a lot of duplicate filenames.
You better think it over.

Actually, if you use the converter it is not necessary to use the rather complicated $if statement - instead, simply add square brackets:
%artist%[ ~ %album%]
I agree on the statement on the sensibility of renaming files to just the artist name. Should also not work for folders with albums...

Thank you for your answers but if the folder is renamed it moves me and I get two files with different names. I would like it to me renome but are not used in a double. What to do?

The converter is for the filename. Renaming just a single file does not affect the folder. In fact, the folder may remain where it was, but empty if you specify a filename with path-parts in it (using the backslash ).
If you want to rename a folder, use the Convert>Tag-Tag function for _directory.
Enter as string the new path.
The current folder will be renamed and take all the files that were in that folder to the new location.

Super thank you.