• 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
system rm from Big Cat
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

system rm from Big Cat


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

Any idea why the script below doesn't work when run from Big Cat's
contextual menu? It should delete the selected file(s) using the Unix rm
command.

(This is an adaptation of a script that runs chown which I downloaded
somewhere--apologies to the original author but I seem to have lost your
name.)

If I add a line saving the generated cmdStr to the clipboard, then paste the
string from the clipboard into Terminal and run it, it does work.

on main(filelist)

set passwordStr to ""
if (passwordStr = "") then
set passwordStr to askPassword
if (passwordStr = "") then return
end if

try
repeat with aFile in filelist
set aFile to aFile as alias
set aPath to posixPath aFile
set cmdStr to "sudo /bin/rm -R " & "\"" & aPath & "\""
system cmdStr
end repeat
on error number errNo
system "sudo -k"
error number errNo
end try

system "sudo -k"
end main

Thanks,
Michael

--
"A time comes when silence is betrayal."
- Dr. Martin Luther King, Jr.
_______________________________________________
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.

  • Follow-Ups:
    • Re: system rm from Big Cat
      • From: Alex Robinson <email@hidden>
  • Prev by Date: [ANN] Image Info 3.0
  • Next by Date: Re: search and count
  • Previous by thread: [ANN] Image Info 3.0
  • Next by thread: Re: system rm from Big Cat
  • Index(es):
    • Date
    • Thread