Intelligent Automation & Macro Software  

Go Back   Automation Anywhere, Inc. Forums > Products Zone > Automation Anywhere
Register FAQ Search Today's Posts Mark Forums Read

Automation Anywhere Post messages and questions related to Automation Software here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-15-2010, 10:37 AM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 100
Default Loop through files in a folder in a custom order

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.'
Reply With Quote
  #2 (permalink)  
Old 01-16-2010, 04:39 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

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.
Attached Files
File Type: atmn loopforTest.atmn (1.8 KB, 8 views)
Reply With Quote
  #3 (permalink)  
Old 02-23-2010, 09:32 AM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 100
Default

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?
Reply With Quote
  #4 (permalink)  
Old 02-24-2010, 04:11 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

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.
Reply With Quote
  #5 (permalink)  
Old 02-24-2010, 05:44 AM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 100
Default

Quote:
Originally Posted by forumsupport View Post
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.
Yes, but this still takes a long time because its not looping in order of 'Modified Date.' I'm aiming to speed up my task by looping in order of 'Modified Date' and then stopping as soon as 'Modified Date' = a specific date.
Reply With Quote
  #6 (permalink)  
Old 02-25-2010, 05:06 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

May we please know the type of file operation(s) that you need to perform with files whose 'Modified Date' = a specific date?
Reply With Quote
  #7 (permalink)  
Old 02-25-2010, 05:40 AM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 100
Default

Quote:
Originally Posted by forumsupport View Post
Hello,

May we please know the type of file operation(s) that you need to perform with files whose 'Modified Date' = a specific date?
Loop through files in folder
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
Email
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!
Reply With Quote
  #8 (permalink)  
Old 03-01-2010, 11:33 AM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 100
Default

Please let me if this can or cannot be done.

Its very important, and I want to know if I should bother waiting for a response.
Reply With Quote
  #9 (permalink)  
Old 03-01-2010, 08:19 PM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

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
Email
End Loop


End Loop

Delete Folder "C:\Temp"

Hope that helps.
Reply With Quote
  #10 (permalink)  
Old 03-08-2010, 07:45 AM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 100
Default

Quote:
Originally Posted by forumsupport View Post
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
Email
End Loop


End Loop

Delete Folder "C:\Temp"

Hope that helps.
I don't see how this is any faster then:
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?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -7. The time now is 09:27 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.
Copyright © 2003-2011 Automation Anywhere, Inc. All rights reserved