Extracting a directory from resources to the workingDirectory

I’m developing a bamboo task plugin and need a directory from my resources to be extracted to the workingDirectory during runtime.
Is there an “Atlassian” way to do this?

I tried some traversal and copying methods but they all didn’t work in the bamboo agent environment.

Thank you for anyone who can shed some light