Re: A simple deletion script
Re: A simple deletion script
- Subject: Re: A simple deletion script
- From: Christopher Nebel <email@hidden>
- Date: Sun, 11 May 2003 12:13:53 -0700
On Sunday, May 11, 2003, at 04:01 AM, John Delacour wrote:
At 10:49 am +0100 11/5/03, H.S. Photo wrote:
Thanks! I was afraid I'd not get a reply to this simple question on
this
list. If you don't mind: is your first line a script I could simply
cut and
paste in Script Editor? Apologies but I am also unfamiliar with the
"shell".
Can I just enter "cd ~/folder : rm nam*" in Script Editor?
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), 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
--Chris Nebel
Apple Development Tools
_______________________________________________
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.