Read and Create Subdirectories in the File System

I would like to copy a directory tree from one location to another.

But, pub.file:listFiles

“The pub.file:listFiles service does not list subdirectories or recursively list subdirectory

I can maybe get around reading subdirectories.

But, I also need to create a subdirectory at a network location and then put some stuff into that directory.

Any idea on how to create a subdirectory in the file system?

I’m trying to now workaround it by using an “executeOSCommand” to do a mkdir on a mapped drive.

But, … yuck. Got to be a better way, no?

You can develop your own file-related java services.

What is your webMethods version? from v8.2 and above you have executeOSCommand service as part of WmPublic.

executeOSCommand is also available in PS utils.

you can write a wrapper service using in built services.

that won’t be a very clean solution as you have to do lot of repeated dir and lot of string manuplation to get folder names etc.

As wang suggested, i also think writing your own custom solution will make more sense and give you more control.

I personally avoid, and recommend against, executeOSCommand whenever possible. Like others on this thread, I too suggest writing your own Java service. However, you don’t have to do it from scratch. There are well known libraries that do exactly what you want. E.g. Apache Commons:,