When dealing with file/directory manipulation in a command, you should always surround the path in double quotes - either with the $qt() identifier, or with literal " " characters (and $+ where necessary). This ensures that the entire path is used in the command, even if it contains spaces. This is not necessary within identifiers since parameters are comma rather than space separated.

mkdir $qt(%main $+ \ $+ %file)