system rm from Big Cat
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.