Re: Need help with script
Re: Need help with script
- Subject: Re: Need help with script
- From: Emmanuel <email@hidden>
- Date: Fri, 20 Dec 2002 19:00:44 +0100
At 1:19 PM -0500 19/12/02, Paul Ricci wrote:
I have never used applescript but feel I have a need for it at the moment so
if someone is able to do this for me I would greatly appreciate it.
I have a folder with some text files in it. I need a script that would open
each file one at a time, look for a certain word (it could change so if need
I can just change the code) and if it appears, leave it and if it does not,
put it in the trash.
If this is easy and someone could post something for me I would be very
thankful. If it is not and payment is required to do this, I will see what
I can do.
I may have missed something, but I did not see any reply to this
post, so I'll post an attempt of a solution.
----------------------------- untested -- untested -- untested --
untested -- untested
-- suppose "theFolder" contains the path name to the folder, as a
string (ending with ":")
-- and "theString" contains the string to find
set theListOfFiles to (list folder alias theFolder invisibles false)
repeat with theName in theListOfFiles
set theName to contents of theName
set theFile to alias (theFolder & theName)
if theString is in (read theFile) then tell application
"Finder" to delete theFile
end repeat
-----------------------------
HTH!
Emmanuel
_______________________________________________
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.