Re: scripting a find
Re: scripting a find
- Subject: Re: scripting a find
- From: Andy Wylie <email@hidden>
- Date: Fri, 01 Jun 2001 13:04:50 +1200
on 1/6/01 4:29 AM, Brian Mather at email@hidden wrote:
>
I'm stumped and would love some guidance. I've already completed this
>
project manually making some of this moot, but face it so often that a more
>
automated solution would be prudent, I believe.
>
>
Here's my project and my goals:
>
>
I have a text (tab delimited) file listing a number of files I want to find
>
on a mounted network volume, copy to a local machine and then delete from
>
the network volume. When searching for each file the result will be several
>
files found (some jpeg, some gif and 1 psd file). I'd like to evaluate the
>
results and copy the psd file to my local machine and then delete every
>
occurrence of the file from the network volume.
>
>
I've found at Macscripter,net several threads describing how to complete, or
>
at least attempt searches using sherlock, and detailing the need to index a
>
volume in order for it to work properly. Unfortunately, I've so far been
>
unable to index the mounted volume enabling this approach and frankly am not
>
optimistic I'll be able to do this. Are there any alternative approaches I
>
should consider?
>
>
Here are the beginnings of a script. As you'll no doubt see I've not yet
>
added the evaluation process and the subsequent copy and/or delete steps,
>
not have I figured out how to tell sherlock which volume to search.
>
>
Any advice gladly accepted.
>
---begin script
>
set file_ref to open for access file "Macintosh HD:Desktop folder:blah"
>
set the_text to read file_ref
>
close access file_ref
>
>
set oldDelimiters to AppleScript's text item delimiters
>
set AppleScript's text item delimiters to return
>
set all_my_text to every text item of the_text
>
set AppleScript's text item delimiters to oldDelimiters
>
set my_text to {}
>
repeat with x from 1 to ((length of all_my_text))
>
set my_text to my_text & {word 1 of item x of all_my_text}
>
end repeat
>
repeat with i in my_text
>
tell application "Sherlock 2"
>
activate
>
search for i -- with display
>
-- how do I indicate which volume to search?
>
-- evaluate, copy and delete: no idea of the syntax...
>
end tell
>
end repeat
>
If you don't mind Akua...
set the_list to the entries in alias "Documents:" whose names match "Heat
Treatment" whose kinds are a file to a depth of -1 with visibility
-- {"Engineering:Heat Treatment"}
-- 3.13 Seconds 8130 visible items 552.8 MB on 685 MB volume
_____________________________ Andy