Firstly, the formats_paths function returns exactly what it is supposed to. It returns a list of the full paths for each format for the book with the format as a prefix. When using the Template editor, you can see the definition of each function by selecting the function lower half of the editor.
As to your template, I think you are after the name of the directory that holds the book. The following will do this:
Code:
{:'re(formats_paths(),".*\\([^\\]*?)\\[^\\]*?$","\1")'}
The only problem with this is if there are no formats for the book.
If you need to do this on a non-Windows box, the path separator will need to be changed.