</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by iBookUser:
<strong>Hi All,
Applescript is probably the one area of the Mac OS that I know next to nothing about. I'm looking for info on where I could find simple instructions or tutorials on how to use it. Lately I've been thinking it would be nice to know how to use. Looks like it can save lots of time.
I would like to write a script that would go through a folder I have chosen, and delete all files with a certain criteria, say all files with "funny" in the name, something like that. Is it possible? Hard? How would I get started? Any suggestions?
Thanks
Matt</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Why <a href="http://www.apple.com/applescript/" target="_blank">http://www.apple.com/applescript/</a> of course
If you really are committed, you can see if you can get a copy of Danny Goodman's Guide to AppleScript.
Something like that.. I know the name is right.
For your particular question...
deleteAllFunny(choose folder)
on deleteAllFunny(nextFolder)
��
try
����
tell application "Finder"
to copy nextFolder's items
to folderList
����
����
repeat with newFile
in folderList
������
copy newFile's file type
to tempFileType
������
if tempFileType
is "fold"
then
��������deleteAllFunny(newFile)
������
else
��������
if newFile's name
contains "funny"
then
����������
tell application "Finder"
to delete newFile
��������
end if
������
end if
����
end repeat
��
end try
end deleteAllFunny
I used Greg Strange's recursion method and modified it for your use. You can find lots of handlers at <a href="http://www.applemods.com/" target="_blank">http://www.applemods.com/</a> however I wouldn't try actually looking at the code... For some reason it seems like lots of prior coders write all those AppleScripts using methods they learned in computer scienece or whatever. To use that particular script, just paste it into the Script Editor and press run.