This can be done with the help of the xstring package and its macro \StrBehind.
In your case, if \currfiledir returns dirA/dirB/, then
\StrBehind{\currfiledir}{/}
will return dirB/.
In fact the result is "all the stuff behind /"
If you also want to remove the trailing / you can use
\StrBehind{\currfiledir}{/}[\currfilesubdir]
\StrBefore{\currfilesubdir}{/}
In this way you first save the result of \StrBehind in the macro \currfilesubdir and then you use it as the argument of \StrBefore which does the opposite of \StrBehind. The result will be dirB.
Obviously this only works if you have your file in a subdirectory of second level like dirA/dirB/.
If your file is in a deeper subdirectory (let's say dirA/dirB/dirC/dirD/, you can opt for one of the following solutions to automate the whole process.
Print the subdirectory name without the trailing /
Add the following lines in your preamble:
\newcommand{\currlastdir}{%
\StrCount{\currfiledir}{/}[\numberofdirs]%
\ifnum\numberofdirs=1\StrBefore{\currfiledir}{/}\else%
\StrBehind[\numexpr\numberofdirs-1\relax]{\currfiledir}{/}[\currfilesubdir]%
\StrBefore{\currfilesubdir}{/}\fi%
}
and then in your subdocument use
\currlastdir
instead of
\currfiledir
and you will get dirD printed.
Print the subdirectory name with the trailing /
Add the following lines in your preamble:
\newcommand{\currlastdir}{%
\StrCount{\currfiledir}{/}[\numberofdirs]%
\ifnum\numberofdirs=1\currfiledir\else%
\StrBehind[\numexpr\numberofdirs-1\relax]{\currfiledir}{/}\fi%
}
and then in your subdocument use
\currlastdir
instead of
\currfiledir
and you will get dirD/ printed.