Re: Finding and deleting specific extensions.
Re: Finding and deleting specific extensions.
- Subject: Re: Finding and deleting specific extensions.
- From: John Stewart <email@hidden>
- Date: Sun, 14 Sep 2003 07:31:04 -0400
On 9/13/03 at -0700 Team Loco said this
>
Hi all, I'm new to apple scripting, so don't be too critical.
>
>
I am trying to see if there is a way to have an apple script that
>
searches
>
for a specific file extension (html) within a given folder and moving it
>
to
>
the trash; possibly with a confirmation dialog.
>
>
I've found ways to display asking to pick a folder, but I am not quite
>
sure
>
how to implement this, and I would like to eventually have it as a
>
folder
>
action.
>
>
Any help is appreciated. Thanks.
What you ask isn't difficult but it would help to know which operating system and Applescript version you are using. From your
note I would guess OS X for the OS but it isn't a given. There are methods of accomplishing certain tasks which aren't realible
or even available in early versions of AppleScript.
Here is a very simple OS X specific script that covers the basics. It needs a few bells and whistles added such as checking for
.htm files, recursion for sub-folders and error checking.
Be careful of line wrapping.
(* script *)
set foldPath to choose folder with prompt "Pick your folder"
tell application "Finder"
set extension hidden of every file of foldPath to false -- OS X specific
set fList to every file of foldPath whose name ends with ".html"
repeat with aFile in fList
move (contents of aFile) to trash
end repeat
set extension hidden of every file of foldPath to true -- if wanted
end tell
(* end script *)
John
_______________________________________________
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.