How to check Today's dated folder exist or not in specific path

I want to Check whether today’s dated folder exist in my provided path or not using For Each activity.

I have tried below one
In Below screen shot i have declared my path into variable, but when it assign to item in For Each activity it is splitted. that means it is not consider as entire path to check my If condition.

Hi ,

You can try this in if condition
Directory.GetDirectories(“path”).Where(function(x) new DirectoryInfo(x).Name.Equals(now.ToString(“yyyyMMdd”))).Count>0

please replace path with your desired folder path.

Thanks

1 Like

instead of equals use contains
folderpath.contains(now.tostring(“dd-mm-yy”))

this “dd-mm-yy” date format you give just like what you have in folder path

1 Like

I have used this one, but in item it is taking Folder path as c then : then \ like this.
So in if condition it is not consider Folder path as path

hi,

Dont use any for loop just give you desired directory path in place of path and check that condition insisde if.

Thanks

Hi @nilesh.mahajan -
You can use Path Exists activity to find a folder/File exists or not. pass the folderpath along with you folder as input… activity will return an boolean value .
Path - D:\TestFolder\Docs
Folder - 20200417

concatenate path + folder like
(D:\TestFolder\Docs\20200417)
and provide as input to pathexists activity

1 Like

But without Loop how i can check every folder one by one?

My Concern is in For Each activity how to use entire path to check entire path.
In Below screen shot item read splitted path instead of taking entire path. It should consider entire path.

My FolderPath is like below and this entire path should take for checking each item

(Directory.GetDirectories(“D:\stuff”,"*",SearchOption.AllDirectories).Where(function(x) new DirectoryInfo(x).Name.Equals(now.ToString(“yyyyMMdd”))).Count>0).ToString

try this with out loop it check in all subfolders of the root folder

If i used this in If condition it is giving me below error.

image

remove .tostring at the end for checking purpose i have added

Still same issue. I have use below one to check If condition

(Directory.GetDirectories(“C:\Users\punnilen\Desktop\UiPath Test”,"*",SearchOption.AllDirectories).Where(function(x) new DirectoryInfo(x).Name.Equals(now.ToString(“yyyyMMdd”))).Count>0)

image

no error for me can you remove that from if activity and try it again

In my solution it is not working, can you please help

Main.xaml (8.8 KB)

Below is my folder structure where I need to check whether today’s dated folder is there or not with the help of for each or if any another activity feasible.

image

Main (3).xaml (7.7 KB)

please try the above workflow by changing folder path in variable panel default value

Try This , its working for me

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