Re: Need a faster Find Duplicates Routine
Re: Need a faster Find Duplicates Routine
- Subject: Re: Need a faster Find Duplicates Routine
- From: Deivy Petrescu <email@hidden>
- Date: Wed, 28 May 2003 17:33:05 -0400
On Wednesday, May 28, 2003, at 03:48 US/Eastern, Johnny AppleScript
wrote:
I.E.,
IF:
set sourceList to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"j",
"j", "k", "l", "m", "n", "o", "o", "o", "p", "q", "q", "r", "r", "s",
"s"}
[script actions]
THEN:
dupList:{"j", j", "j", "o", "o", "o", "q", "q", "r", "r", "s", "s"}
What I've done in lieu of a good routine so far is break up the entire
list
into alpha-numeric sub-lists; since the current search criteria is
strictly
identical 'Song Name' in tracks, it is much faster to compare each
instance
with 200-300 possible duplicates that begin with the same character,
rather
than needlessly checking several thousand files that do not.
Thanks to all for the suggestions so far; they've given me some ideas
as to
how to improve on what I have.
JA
I use a slightly different dupList
Here:
<script>
set sourceList to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"j", "j", "k", "l", "m", "n", "o", "o", "o", "p", "q", "q", "r", "r",
"s", "s"}
set tested to {}
set dupList to {}
repeat
set itm1 to (item 1 of sourceList) as string
set sourceList to rest of sourceList
if itm1 is not in tested then
set tested to tested & itm1
set mytext to sourceList as string
set AppleScript's text item delimiters to itm1
set knt to count of text items in mytext
if knt > 1 then set end of dupList to {itm1, knt}
end if
set kl to length of sourceList
if kl = 0 then exit repeat
end repeat
set AppleScript's text item delimiters to {""}
dupList
--> {{"j", 3}, {"o", 3}, {"q", 2}, {"r", 2}, {"s", 2}}
</script>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.