Re: A simple deletion script
Re: A simple deletion script
- Subject: Re: A simple deletion script
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 11 May 2003 12:35:20 -0700
On 5/11/03 12:13 PM, "Christopher Nebel" <email@hidden> wrote:
>
On Sunday, May 11, 2003, at 04:01 AM, John Delacour wrote:
>
>
> do shell script "cd ; ls"
>
>
>
> will give you a list of the names of all visible items on your user
>
> directory.
>
>
>
> do shell script "cd ; rm *.jpg"
>
>
>
> will delete *beyond recall* all .jpg files.
>
>
>
> cd means change directory, so if you want to target a certain
>
> directory, then use
>
>
>
> cd /path/to/directory ; ...
>
>
>
> To delete files matching a regular expression, beyond the simple "*"
>
> wildcard, you need to get a bit more technical.
>
>
Oh, just lovely. Here we have a complete newbie, and a language that
>
was designed to be comprehensible to non-programmers, and what do you
>
do? You send him straight to the shell, which is widely known to be
>
one of the *least* newbie-friendly systems in existence.
>
>
Go read the AppleScript Language Guide (just type that into Google to
>
find it),
Of course, don't expect to find 'home' anywhere in the ASLG, nor even
instructions on how to script the (OS 8.6) Finder either, let alone the OS
10.2 Finder. Otherwise, that's a very good idea.
>
and try this (mostly) equivalent script:
>
>
tell application "Finder"
>
move every file of home whose name starts with "nam" to the trash
>
empty the trash
>
end
with the proviso that "complete newbies" also sometimes are the very
people who also use the Trash as a "storage receptacle" and don't want to
empty it. Of course they shouldn't use the trash that way, but sometimes
they do.
It would be great if you could add a new command to the new Disk-Folder-File
suite of System Events that purged individual items (like 'do shell script
"rm" or Jon's Commands' deleteFile) so that people could do this selectively
without emptying the whole trash and without needing obscure shell commands
or 3rd-party additions. Since this suite does not belong to the Finder,
there's no need to confine it just to actions one can take in the UI, is
there?
--
Paul Berkowitz
_______________________________________________
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.