• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: system rm from Big Cat
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: system rm from Big Cat


  • Subject: Re: system rm from Big Cat
  • From: Michael Grant <email@hidden>
  • Date: Mon, 18 Nov 2002 21:05:45 -0600

On 11/18/02 7:27 PM, "Alex Robinson" <email@hidden> wrote:

> This works for me:
>
>>>>>
> on main(filelist)
>
> repeat with aFile in filelist
> set aFile to aFile as alias
> set aPath to posixPath aFile
> set cmdStr to "/bin/rm -R " & "\"" & aPath & "\""
> do shell script cmdStr with administrator privileges
> end repeat
>
> do shell script "sudo -k"
>
> end main
> <<<<

That does work, thanks!--but it asks for the password repeatedly when
deleting more than one file. A little more editing gives this:

on main(filelist)
set thePaths to ""
try
repeat with aFile in filelist
set aFile to aFile as alias
set aPath to posixPath aFile
set thePaths to thePaths & "\"" & aPath & "\" "
end repeat
set cmdStr to "sudo /bin/rm -R " & thePaths
do shell script cmdStr with administrator privileges

on error number errNo
system "sudo -k"
error number errNo
end try

-- invalidate sudo password immediately
system "sudo -k"
end main

And now we've got the answer next time someone complains that they can't get
rid of a file!

Michael
--

"But I also made it clear to [Vladimir Putin] that it's important to think
beyond the old days of when we had the concept that if we blew each other
up, the world would be safe."

? George W. Bush, Washington, D.C., May 1, 2001
_______________________________________________
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.

References: 
 >Re: system rm from Big Cat (From: Alex Robinson <email@hidden>)

  • Prev by Date: Re: Launch Default Mail App attached the file
  • Next by Date: Re: getting headers from Mail
  • Previous by thread: Re: system rm from Big Cat
  • Next by thread: Re: Applescript to export Quicktime movies
  • Index(es):
    • Date
    • Thread