How to verify that a file exists in a network path

file

#1

I can currently save Excel file in a Network path and it Works fine in UIPath. I want to be able to verify that the file is saved and exists in the path. I am currently doing this: System.IO.File.Exists(varPathToDrive+varCurrentExcelFileName) in an assign activity where:
varPathToDrive = "\XXXXX01\ab\YYY\AAA\MyFiles"
varCurrentExcelFileName = "myExcelFileName.xlsx"
When I run it, I get False, but when I run File.Exists with the same path and file name in a console appplication in visual studio, it returns True and I can see that the file was correctly saved and it exists in the path.


#2

Hello,

thank you for inquiring.

I would suggest you to use the Path exist activity like this:

Also I would ask if you have to login to access the network drive. It might not be able to access the folder due to restrictions.


#3

\XXXXX01\ab\YYY\AAA\MyFiles is relative to the running workflow.
Therefore you should use/map an absolute path like C:\\XXXXX01\ab\YYY\AAA\MyFiles