Check Folder Exist

Hello Team,
I’m confused,if i have to create 20 folder at a specific path,If 3(1,2,3) folders are already created,then starting with same sequence(4,5,6),how can i create folder further…
image ,
Created WF can create folders if no folder is currently present…Please guide


You need to use Path Exists activity and pass folder path into it to check whether specified folder existing or not. If it existing then it will give output as True then you no need to create folder else you create folder using Create Folder activity.

@Mayyur - no need to check if the path exists first. If you use the ‘Create Directory’ activity it will automatically create the specified folder + subfolder(s). If the specified folder already exists, it will do nothing.


let me reframe question,i have created counter which increases 1,2,3…20 each by 1 after creating folder,but in if activity is folder is found then i need to jump on next sequential number and create folder…i hope you got my problem

Main.xaml (6.8 KB)

@Mayyur - @lakshman’s solution should work for you.

1 Like

@Mayyur - you have your Check Directory activity outside the loop. Therefore it is only looping until it finds a path that already exists. You need to restructure the workflow so the entire thing is contained within your loop.

I prefer using a for loop for this sort of a thing since it auto-increments the counter. Here I have taken your .xaml and streamlined it a bit. Let me know if it is working the way you’d expect:

Main-dave updated.xaml (9.0 KB)

If you want to do this all in one step you can also use the Directory.GetDirectories command in an invoke code activity. This will return a list of folders, you can sort the list as desired and get the first or last entry using assign activity to determine the highest counter number.