File management is inevitable in business processes automations.
We might want to copy, move or delete files based on few conditions…!!!
Let’s see how to get the specific type of files from a folder
_myList = Directory.GetFiles(_folderPath,”*.zip”,System.IO.SearchOption.AllDirectories)
- _folderPath is the folder path where you have your files
2._myList is the variable containing your required files
3.Replace “*.zip” with your desired extension.
Implementation using UiPath :
Let us implement a workflow which displays the names of particular files(.i.e .zip extension files) from a folder.
Drag “Assign” activity into the design panel and populate it with your folder path
Drag “Assign” activity into the design panel and populate it with above-mentioned code
Drag “For Each” activity into the design panel and pass the above “filesList” variable to it.
Drag “Message Box” activity into the For Each activity and pass the “item” value into it.
when we run it, we can see the file names of .zip extension being displayed.