Bot-Factory 602 Posted January 18, 2014 Report Share Posted January 18, 2014 Hello. I have two list with file paths and file names. Example:d:\files\info.exec:\test\hallo.exe The first list is my source list. And I want to identify if items from my second list are included in list1. Here is my current code: set list position(%file1, 0) set list position(%file2, 0) loop($list total(%file1)) { set list position(%file2, 0) loop($list total(%file2)) { set(#xxxx, $find regular expression($next list item(%file2), "(?<=\\\\)[a-zA-Z\\s]+\\.exe"), "Global") if($comparison($find regular expression($next list item(%file1), "(?<=\\\\)[a-zA-Z\\s]+\\.exe"), "=", #xxxx)) { then { alert("juhu") } else { } } } } My first list has 100 files. And the second one 30. So that 100x30 loops. If there is a match, I need the full path+filename from the match in the file1 and the file2 list. So I can not just edit the list to only include the filenames. But the matching must be done only by the filename because the folders will be different. Any idea how the speed could be improved here? Thanks in advance for your helpDan Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 18, 2014 Report Share Posted January 18, 2014 This might help you: http://www.ubotstudio.com/forum/index.php?/topic/14632-case-study-988-speed-increase-working-with-large-lists/ Also check out this: http://www.ubotstudio.com/forum/index.php?/topic/13237-free-file-management-plugin-multiple-commands-and-functions/?p=84520 Hopefully that gives you some ideas Quote Link to post Share on other sites
k1lv9h 76 Posted January 19, 2014 Report Share Posted January 19, 2014 Hi, Changed:1. loop to loop while. Should exit loop while on match.2. $find regular expression to $replace regular expression.3. Added if then else checks to avoid exceed list error Code: set list position(%file1, 0) set list position(%file2, 0) loop($list total(%file1)) { if($comparison($list position(%file1), "<", $list total(%file1))) { then { set(#xxxx, $replace regular expression($next list item(%file1), ".*\\\\", $nothing), "Global") set list position(%file2, 0) set(#foundmatch, $false, "Global") loop while($both($comparison(#foundmatch, "=", $false), $comparison($list position(%file2), "<", $list total(%file2)))) { if($comparison($list position(%file2), "<", $list total(%file2))) { then { if($comparison($replace regular expression($next list item(%file2), ".*\\\\", $nothing), "=", #xxxx)) { then { alert("juhu {#xxxx}") set(#foundmatch, $true, "Global") } else { } } } else { } } } } else { } } }Kevin Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.