Path Exist Not Working

Hi! I am having an issue where the Path Exists activity is not following the loop–if the file doesn’t exist, then it keeps checking for it until it’s found. I watched the process and the folder where the file gets saved. The flowchart and decision just accepts the file exists; however, it wasn’t there. Because of this, the next action, Close Window, throws an error. I have an Assign Activity that makes the Exists variable False. For whatever reason, the Path Exists Activity is changing the value to True, even though the file does not yet exist. Any guidance would be greatly appreciated! Thank you in advance!

@SynergiBot

Two things to check on.

  1. Make sure path exists is set to file and not folder.
  2. If not the above case, Make sure you print path that you ahve provided in Path exists and print this, Manually open this location and check for any raw file .
1 Like

Hi! Thanks for responding! It is definitely set to File–not Folder. I watched the folder as the file was downloading. There was no file at all for quite a few seconds, then a randomly-coded filename appeared quickly before disappearing. Finally, the filename appeared. By the time the filename appeared in the folder, the error was thrown in the process.

@SynergiBot

That’s what happened with me, your random file might be a raw file with same name or

do you have any naming convention , generally these raw files start with $.

Well to avoid it best way to check file is file extension and name.

path.getfilename(“Filepath”).equals(“NameofExpectedFile”).
You can use Wildcards here/

I have a naming convention–AL_CL_20200630_113701.pdf, for example. It includes the state abbreviation, letter type, date, and time that are all captured within variables and passed to the Activities. It definitely looks like a raw file that shows up. That extra information is good to know! Thank you for sharing! It’s maddening that it passes through and then throws the exception in the next action because the file isn’t there. I’ll test that out. Thanks again!

1 Like

@SynergiBot

Just one thing to add here.
For folder where you save these files.
Just before path exists, Use a assign.

Files = directory.getFiles(“FolderPath”)
for each file in files

writeline(file)

This way, you will see what all files are being generated and you also have anme fo the file that is geenrated as RAW.

Please ignore my typos :stuck_out_tongue:

Now this silly Path Exists Activity is not finding a file that does exist. I have a variable, FN, that holds the filename. The Assign Activity for variable FN uses a formula to create what is needed–the file path, state abbreviation, letter type, date, and time–down to the second. I just added a Message Box if the flow decision is False to tell me what is in the variable, FN. I verified that it matches the entire file path. What am I missing?

1 Like

@SynergiBot

Can you try this with your code.

Sequence2.xaml (5.3 KB)

Here’s how I have it set up, and… now it seems to be working. Hope you can see this! I have my FN variable that contains the file path, name, and type in the Path of the Path Exists Activity. The PathType is set to File. The variable Exists is in the condition of the Flow Decision.

image001.png

1 Like

That’s great.
Seems like a ego issue with code, you might have hurt you code a bit :stuck_out_tongue:
You should look for cause as it might cause issues later on.
Happy Automation :slight_smile:

1 Like

Definitely trying to identify the root cause of this issue because I will have close to 100 processes that depend on the logic of path exists. The reason I’m using Path Exists is to ensure that a file has downloaded before the bot closes the tab/window. I’m hoping this logic makes sense because if the window is closed before the download is complete, not all documents will be downloaded. Thanks for all your help! :slight_smile:

1 Like

@SynergiBot

This is exactly what i would have used.