How to move folders/directories in Flow

We have webMethods 9.12 (Linux)

Can someone please tell me how in Flow I would be able to move a folder under a particular folder to another folder?

For instance, below is a folder(dir) named Error_Directory and it contains many files underneath it. Need to move that directory and all of its content to be under FIX_DIRECTORY where I have a program that monitors FIX_DIRECTORY and does things from there.

I can’t believe how badly I’m struggling with just trying to move a directory to another directory.

/ BAD_DIRECTORY / Error_Directory_20180626 to

/ FIX_DIRECTORY / Error_Directory_20180626

All I see in webMethods is a moveFile, not a move directory, but maybe there is some other way to do what I’m needing done and am just not thinking straight.

Any suggestions?

Thanks for any help.

Have you tried using “pub.utils:executeOSCommand” see XX_Integration_Server_Built-In_Services_Reference for more details.

1 Like

You can either use executeOSCommand (as M@he$h suggested) and issue some command to move the folder (“mv” in Linux?) or write your own java service for this (using Java file/folder operations).

1 Like

Okay, thanks for your help! I will give a try. Never heard of that command before.

If you have not started one already, I would create your own equivalent to WmPublic. Use your company or appropriate name, like ABC_Public. Then create the utilities that are basic/common, such as this service, in here. FLOW and Java services that do useful, general things.

You’ll want to adopt a reasonable naming convention. You’ll probably want to avoid simply mimicking the methods found in Java classes as callable services. Make life for callers a little easier. For example, create a service that can move files or directories. Or if you’re going to create services to manage a hashmap, get the creation adding of one or more items to the map in one service, rather than “createHashmap” and “addHashmap”.

I won’t delve into details here unless you want but I would strongly encourage avoiding the use of executeOSCommand. Create your own Java service as fml2 suggests.