Path Exist activity

Hi All,

My case
I have a folder in my sharedrive (name: 2018). In this folder I will store Excel file in .xlsx this file name will be random each month

I have an activity: Path exists and I want to check if in folder I have an excel file. Then If I have I want to send a message

I did it in the way, and I have all the time message “wrong”

Hi @niteckam,

Path Exists will only work if you are looking for a specific file. What you will want to use probably is GetFiles() and that will give you a list of all files in that folder.

Directory.GetFiles(folderpath)

That will give you an array so that you can filter or take its count

Directory.GetFiles(folderpath).Count

.Count will tell you if any files were found.

Hope this is helpful.

Regards.

2 Likes

Hi @niteckam,

In addition to the solution by @ClaytonM which is the way forward, you can check when was the file updated using

Directory.GetLastWriteTime(item.ToString).ToLongDateString
while iterating through the array of file items. This will tell you whether there is a file created on specific month.

Regards,
Shiju Mathew

1 Like