Hi Tejas,
Not sure if this will be able to solve the issue as I didn't test the same with 1 lac folders
😛 But well, you can give it a shot as I am using LINQ queries with Folder Retrieval as a part of the below custom code stage. I am using LINQ queries as it can speed up your collection filtering by miles.
You can create a new business object and add the below External References ('System.Data.DataSetExtensions.dll', 'System.Core.dll') and Namespace Imports ('System.Data.DataSetExtensions', 'System.LINQ', 'System.IO' and 'System.Collections.Generic') on the Page Description stage of your Initialize action for the LINQ queries to work properly. Also, ensure that the language is selected as 'Visual Basic':
Once you have the updated code options as shown above, create a new action named 'Get Folders By Filters' and pass three input arguments, Folder Path (Text) and Start Date (Date) and End Date (Date). Based on the field names that you provide the unique records will be fetched from the Input Collection. Also, set an Output parameter as Folders (Collection) for this action as shown below:
Add the code stage and use the below code with the input and out arguments as show:Dim folderDir As New DirectoryInfo(Folder_Path)
Dim folder_enum = (From folder In folderDir.GetDirectories() _
Where folder.LastWriteTimeUtc.Date >= Start_date And folder.LastWriteTimeUtc.Date <= End_Date _
Select New With {.FolderName = folder.Name, .Path = folder.FullName, .Created = folder.CreationTimeUtc, .LastAccessed = folder.LastAccessTimeUtc, _
.LastWritten = folder.LastWriteTimeUtc})
Dim dt As New DataTable
dt.Columns.Add("Folder Name")
dt.Columns.Add("Path")
dt.Columns.Add("Created")
dt.Columns.Add("Last Accessed")
dt.Columns.Add("Last Written")
Dim dr As DataRow
For Each item In folder_enum
dr = dt.NewRow
dr("Folder Name") = item.FolderName
dr("Path") = item.Path
dr("Created") = item.Created
dr("Last Accessed") = item.LastAccessed
dr("Last Written") = item.LastWritten
dt.Rows.Add(dr)
Next
Folders = dt
The run results are as follows:Input Arguments:
Output Result:
------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future
Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website:
https://devneet.github.io/Email: devneetmohanty07@gmail.com
----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.