Path Exist activity

activities
core_activities

#1

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”


#2

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.


#3

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