Searching if Folder Exists on Shared Drive and moving file and renaming if already exists

Hi Guys,

In need of some advice; I’ve got a process which creates a file named based on what it has collected earlier - Account ID etc. But at the end of the process I am trying to check if the folder which is named the same minus EDD_ at the beginning and then contains the file.

But I would like to check if the folder exists, if it doesn’t, create it, if it does, save the file in this location.

The trouble then lies in the ‘Move files’

I have something incorrect, So if the file exists I’d like to save this file renamed with the date attached to the end so it saves there no problem.

Something in my code is incorrect but I am having difficulty rectifying.

Please see attached a couple of the workflows, would appreciate if someone could advise.

Thanks :smiley:

Dir_RenameTheTemplate.xaml (6.8 KB)

Dir_CopyToSharedDrive.xaml (7.8 KB)

Hey,

I checked your workflows and your usage of Path Exist and If Condition looks fine.

What seems to be the problem with ‘Move files’?

Cheers, Lukas

Thanks, Lukas,

I feel that the problem may lie in the renaming convention, as the error I am receiving is that it cannot find the file (if the date addition on the end is necessary)…

I think I understand now.

You have added +Now.ToString("ddMMyy") to the From-Path aswell.
But does the From-Path even change? My guess is, that the From-Path stays the same and you should give it the same From-Path as in the other Move File activity.
Only the To-Path changes - that is where you need the +Now.ToString("ddMMyy").

Kindly check if this is the solution :slight_smile:

Edit: If you use different filepaths like in this workflow, I would recommend you to put them in variables (and initialize them there) for code clarity
Example: FilepathSource, FilepathDestination ( + Date)

Cheers, Lukas

Hi Lukas,

I think you are bang on there! I will test a full run soon and let you know!

Really appreciate the help here!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.