Re: How to compare contents of a folder against a list?
Re: How to compare contents of a folder against a list?
- Subject: Re: How to compare contents of a folder against a list?
- From: "J. Stewart" <email@hidden>
- Date: Wed, 2 May 2007 17:08:29 -0400
On 5/2/07 at 12:22 PM, Patrik B. <email@hidden> spake thusly:
One directory has my master set in it. For example "Book1.psd", "CD1.tiff"
my script has a variable set called "SPA", "FRE", "GER", "ITA", "ENG" etc.
I now want to compare my master set using the prefix variable and check if the
folder with 736 images contains a complete set for each language. If not then
I want the names of the images that are missing given back to me in a variable
so I can send it to my art department and say so and so images are missing.
The part I need help with is the comparing of the two lists. How do I check if
a folder contains "FRE-Book1.psd" for example. I think the rest I can figure out.
This is not meant as a functional script, it's meant to give you
an idea of how this could be accomplished. It assumes that you
have the various files in folders named for the languages.
(* pseudo script *)
property langs : {"SPA", "FRE", "GER", "ITA", "ENG"}
set msngFiles to {}
tell application "finder"
set masNames to name of (every file of entire contents of alias "path;to:folder:Master:")
end tell
repeat with aLang in langs
tell app "finder"
set filNames to name of (every file of entire contents of alias
("path:to:languages:folder:" as uncode text & contents of aLang))
end tell
repeat with aName in masNames
repeat 1 times
set temp to (contents of aLang & "-" & contents of aName)
if temp is in filNames then exit repeat -- if file is present
set end of msngFiles to temp -- if file is not present
end repeat
end repeat
end repeat
return msngFiles
(* /pseudo script *)
This was written on the fly and not tested or even compiled. It
needs to have your actual folder/file names/paths which I
obviously don't have. It wouldn't be particularly quick as
written either. Once you have a working version, post it and
perhaps we can optimize it for you.
JBS
--
OK... so if the Jacksonville Jaguars are known as the "Jags" and
the Tampa Bay Buccaneers are known as the "Bucs", what does that
make the Tennessee Titans? - George Carlin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden