How to get folder by matching given input

Hi,

I have a scenario, where my input is eg - 90075068. Bot should go and check in folder caller Temp “C:\Users\moukola\OneDrive - Capgemini\Desktop\Temp” if there is any folder contains with number - “90075068”. If yes then bot should not delete folder in path - “C:\Users\moukola\OneDrive - Capgemini\Desktop\Temp” if no then bot should delete Temp folder.

Thanks in Advance

@hemasai.06

You have an activity for folder existance and delete the folder…you can use them perform the required actions

These would give boolean values as output use them
In if conditions

Cheers

Hi @hemasai.06 ,

Please check this below attached workflow to delete folder based on your condition,
Uipath_DeleteFolderOnCondition.xaml (6.3 KB)

Hope this helps :slight_smile:

1 Like

Hi @hemasai.06 ,

Specifically for the implementation, you could have the input in a variable, say InputVar. Then we can use this with the Directory Path for the Folder Existence and then Delete if the Folder is not present using an If and Delete Folder Activity.

InputVar = "90075068"
Directory.Exists(Path.Combine("C:\Users\moukola\OneDrive - Capgemini\Desktop\Temp",InputVar))

Using an If Activity :
image

Let us know if you need further help.