![]() |
| |||||||
Automation Anywhere Post messages and questions related to Automation Software here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
The default seems to be to loop through the files in alphabetical order. Can anyone think of a way to force AA to loop through the files in a different order such as 'Date modified.'
|
| |||
|
Hello, What you can try is, . Open your folder in Windows Explorer and arrange the list by 'Modified Date' . Create task that would use Manage Windows Control command to capture the list of file names into AA Variable. For your reference, we have attached a sample task. Please copy it under location, 'C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks' folder. Before you run this task, you need to edit the Window titles as per the requirement and recapture the first file in the list. Hope that helps. |
| |||
|
This won't work well, as I have 30,000+ files to loop through in the folder. The reason I want to sort by 'modified date' is because I only want it to loop through files with a creation date of the last few days. It takes way too long to loop through 30k files to capture the modified date. Are there any better options? |
| |||
|
Hello, You can loop for each file in a folder then inside loop use 'Files/Folder' command for file manipulation, this command supports 'Advanced' option to check and perform action only if 'Modified date' is in last few days (you can specify the days). It can also check if file is modified between specified dates or if file is modified before specific date. |
| |||
| Quote:
|
| |||
| Quote:
If 'modified date' > 30 days ago then Exit Loop End If SQL SELECT using $FileName$ Loop through SQL IF $Database Column(1)$ includes "xxxxx" then SQL Insert SQL Update End Loop End Loop This is only efficient if I can loop in order of 'modified date.' That way as soon as it encounters documents modified 30 days ago it will exit the loop. Thus it won't waste hours (literally) looping through files I don't want it to check. Thanks! |
| |||
|
Hello, Apologies for the inconvenience. What we suggest is, as a part of task, create a temporary folder, copy the file with modified date in last 30 days, loop for that temp folder and update sql and at the end delete that temporary folder. That way is reliable and faster. Below is the text format of task. Create Folder "C:\Temp" Copy Files "C:\SourceFolder\*.*" to "C:\Temp\" if file is modified in last 30 days Start Loop " Each File in C:\Temp" SQL SELECT using $FileName$ Loop through SQL IF $Database Column(1)$ includes "xxxxx" then SQL Insert SQL Update End Loop End Loop Delete Folder "C:\Temp" Hope that helps. |
| |||
| Quote:
If file modified in last 30 days Blah Blah End If In both scenarios it still needs to examine every File. Is there not a way, to only loop through the files modified in last 30 days? |
![]() |
| Thread Tools | |
| Display Modes | |
| |