You are viewing limited content. For full access, please sign in.

Question

Question

Using Workflow (On Premises) - How to Determine if a folder exists before attempting to move a file into it?

asked on February 1

I'm trying to do something rather simple (I think). I have a workflow that moves files into a folder in an archive directory based on the persons name. Sometimes the Names were saved with Spaces, sometimes underscores, sometimes they used a middle initial, sometimes they didnt. So I want to start by seeing if the BEST named folder exists.

So if someone's name on a document is Raymond P. Bradbury, I want to move that document to the folder in /ArchivedWriters/Ray-P-Bradbury/

Someone may have already created a folder named Raymond-P-Bradbury so first I want to try to move the file into there using a conditional to see if the folder "Ray_P_Bradbury" exists in /ArchivedWriters

But the string I have from the document might be "Ray P Bradbury", "Ray-P-Bradbury" or even just "xxxx_bradbury". If "Ray_P_Bradbury" exists as a folder, I want the file in there. If it doesnt, but "Ray P Bradbury" (spaces instead of underscores) - I want the file in there, otherwise I want to create a new folder to archive the Ray Bradbury docs into.

The thing I'm getting stuck at is a test to see if a folder with the optimal naming convention exists at all.

0 0

Replies

replied on February 1

You can use Create Entry on the folder and turn on the option to return the existing one if it already exists

2 0
replied on February 1

Your best bet is probably to use a Search Repository activity to search for the folder with the preferred name in the preferred location.  Additional Search Repository activities to search for the folder with each alternate name option as well.  Then use a conditional decision to decide how to proceed.  Condition 1 checks for results from the first search activity, condition 2 checks from the second search, etc.  And then you have a last condition option of the conditional decision to handle any situation where none of the searches returned any results.

If for example, you have the preferred name, and two alternates, it might look something like this:

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.