Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

I need some help

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  Mac VPC No Longer on MS Site  
Author Message
Michelle Steiner

External


Since: Jul 15, 2003
Posts: 6253



(Msg. 1) Posted: Thu Jan 17, 2008 7:35 pm
Post subject: I need some help
Imported from groups: alt>comp>lang>applescript (more info?)

This message is not archived

 >> Stay informed about: I need some help 
Back to top
Login to vote
Michael Siemon

External


Since: Mar 31, 2004
Posts: 73



(Msg. 2) Posted: Thu Jan 17, 2008 7:35 pm
Post subject: Re: I need some help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <michelle-5ABD5C.19353617012008.TakeThisOut@news.west.cox.net>,
Michelle Steiner <michelle.TakeThisOut@michelle.org> wrote:

> set the File_to_remove to ¬
> (quoted form of POSIX path of (choose file))
> do shell script "rm " & File_to_remove
>
> The above script works unless the file is a bundle, in which case I get
> an alert saying that it is a directory. How can I modify the script to
> get it to remove either a file or a bundle?

try "rm -fR" ?

 >> Stay informed about: I need some help 
Back to top
Login to vote
Michelle Steiner

External


Since: Jul 15, 2003
Posts: 6253



(Msg. 3) Posted: Thu Jan 17, 2008 7:57 pm
Post subject: Re: I need some help [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
Jolly Roger

External


Since: Sep 09, 2006
Posts: 3119



(Msg. 4) Posted: Thu Jan 17, 2008 9:46 pm
Post subject: Re: I need some help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <michelle-C2652A.19571517012008.TakeThisOut@news.west.cox.net>,
Michelle Steiner <michelle.TakeThisOut@michelle.org> wrote:

> In article <mlsiemon-EC7C73.18412917012008.TakeThisOut@nnrp-virt.nntp.sonic.net>,
> Michael Siemon <mlsiemon.TakeThisOut@sonic.net> wrote:
>
> > > The above script works unless the file is a bundle, in which case I
> > > get an alert saying that it is a directory. How can I modify the
> > > script to get it to remove either a file or a bundle?
> >
> > try "rm -fR" ?
>
> Thanks. I settled on this:
>
> set the File_to_remove to ¬
> (quoted form of POSIX path of (choose file))
> do shell script "rm -r " & File_to_remove

Note: With the -r switch, "rm", will attempt to prompt you asking if you
would like to override permissions for a given directory or file if that
item's permissions and/or ownership are restricted to your user account.
Since user interaction is not possible within the "do shell script"
command, if this happens, your script may block or generate an error.

If you add the -f switch, the potential for such a prompt is less, but
it can still happen if you attempt to delete something that has very
restrictive permissions and/or ownership. You may want to deliberately
change permissions and ownership of some test files to see the effects
on your script.

--
Note: Please send all responses to the relevant news group. If you
must contact me through e-mail, let me know when you send email to
this address so that your email doesn't get eaten by my SPAM filter.

JR
 >> Stay informed about: I need some help 
Back to top
Login to vote
Joshua Whalen

External


Since: Jan 21, 2007
Posts: 37



(Msg. 5) Posted: Mon Feb 04, 2008 9:57 pm
Post subject: Re: I need some help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <michelle-5ABD5C.19353617012008.TakeThisOut@news.west.cox.net>,
Michelle Steiner <michelle.TakeThisOut@michelle.org> wrote:

> set the File_to_remove to ¬
> (quoted form of POSIX path of (choose file))
> do shell script "rm " & File_to_remove
>
> The above script works unless the file is a bundle, in which case I get
> an alert saying that it is a directory. How can I modify the script to
> get it to remove either a file or a bundle?

change "rm" to "rm -r". that should do it.
 >> Stay informed about: I need some help 
Back to top
Login to vote
Joshua Whalen

External


Since: Jan 21, 2007
Posts: 37



(Msg. 6) Posted: Mon Feb 04, 2008 9:59 pm
Post subject: Re: I need some help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <michelle-5ABD5C.19353617012008 DeleteThis @news.west.cox.net>,
Michelle Steiner <michelle DeleteThis @michelle.org> wrote:

> set the File_to_remove to ¬
> (quoted form of POSIX path of (choose file))
> do shell script "rm " & File_to_remove
>
> The above script works unless the file is a bundle, in which case I get
> an alert saying that it is a directory. How can I modify the script to
> get it to remove either a file or a bundle?

change "rm" to "rm -r", then wrap the "do shell script" routine in a
"try" block to pre-empt any error messages. that should do it.

Nice to finally be able to help you out after all the times you helped
me!

Joshua
 >> Stay informed about: I need some help 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Scripting Icons on Desktop (Panther) - Hi, new to OSX and want to reproduce a script I had for OS9 that moved all icons on desktop into several rows center-right of screen then re-positioned them in specific places around the screen - any left in the center were obviously new..

URL / Webloc drop - Does anyone have any pointers or sample code to handle the drop of a URL or "webloc" from something like Safari on to an Applescript application? I'm not having too much luck getting this working. Many thanks. -- rik

echo "blah" >> file.txt - how to do this with AppleScript? - Hi, I have a little AppleScript which calls shell commands to create a text file and append strings to it: ***** -- set variables set filepath to "'/Users/claus/the testfile.txt'" set line1 to "Line 1" set line2 to "Line 2&quot...

Delete all items of a specific folder - Hi, Beginner?s question: I want to delete all items inside a specific folder. However, the following attempt does not work. Where is the problem? delete every item of "claus:Library:Xchange:iPod:Aufgaben:" Greetings, Claus

Drag and Drop applet for UNIX Diction and Style? - I was wondering if there exists, (or anyone would take it on as a coding project, a drag and drop applet that would save a Style and/or Diction report- a readability score more or less, from a plain text file dropped upon this. This may very well alread...
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]