Re: helppp...
Re: helppp...
- Subject: Re: helppp...
- From: Michelle Steiner <email@hidden>
- Date: Mon, 9 Apr 2001 18:18:41 -0700
On 4/9/01 6:44 AM, Giao Nguyen <email@hidden> wrote:
>
the task that i was given was to sort through folders. each folder can
>
have many subfolders. i am to sort through and trash all the .gif,
>
.html, and .jpg. the .jpg files, i am to trash the ones that are very
>
small like less than 12K.
I hope that I just didn't do your school homework for you, but here's a
script that will do what you ask.
--Michelle
tell application "Finder"
set startingItem to item 1 of the selection
if kind of startingItem is "folder" then
my processItems(startingItem)
else
display dialog "You must select a folder." buttons "Oh OK." default
button 1 with icon note
end if
end tell
on processItems(itemToBeProcessed)
set the testList to {".gif", "html", ".jpg", ".htm"}
tell application "Finder"
set containedFiles to every item of itemToBeProcessed whose kind is not
"folder"
set containedFolders to every item of itemToBeProcessed whose kind is
"folder"
repeat with fileToTest in containedFiles
set testFileName to the name of the fileToTest
set the fileSuffix to text -4 through -1 of the testFileName
if the fileSuffix is in the testList then
if the size of the fileToTest is less than 12000 then
delete the fileToTest
end if
end if
end repeat
repeat with folderToProcess in containedFolders
my processItems(folderToProcess)
end repeat
end tell
end processItems
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------