Re: Deleting "cached" items from the volumes folder
Re: Deleting "cached" items from the volumes folder
- Subject: Re: Deleting "cached" items from the volumes folder
- From: "J. Stewart" <email@hidden>
- Date: Fri, 18 Apr 2008 16:58:46 -0400
On 4/18/08 at 1:48 PM, MR_THEOBALD <email@hidden> spake thusly:
Greetings to all...
Earlier in the week I posted a request for some help with
deleting a folder which gets "cached" when some of our
kindergarten students turn off a machine without ejecting a
shared volume prior to the shutdown. The client computers
"cache" or store an alias or duplicate folder of the share
point in the volumes folder. I've written a script to move the
suspect folder(s) to the trash when a new user logs into the
machine, however, since the folder was created by a different
user, the new user needs to input an admin password to complete
the deletion. I want all of that to be performed for the new
student before the windows are all closed. All works as is
expected except for being able to perform the action as an
admin user.
Am I asking a stupid ?? here or is it possible to do this?
I've searched and searched and attempted a multitude of samples
to get this to work without success. Any help would be
appreciated even if it is: "That's pretty easy to do RTFMS."
Excuse the simplicity... I'm new to applescript.
Thanks again for any input and have a joyous weekend!
Regards,
Joe
<snip>
Something like this should work. I'd suggest saving it as an
application and running it as a login item. It doesn't trigger
an admin password. You might want to be careful about the script
emptying the trash for a while. I've commented that step out in
this example.
My System Version 10.5.2, Applescript Version 2.0, Script
Debugger Version 4.0.8
--> Cut <--
set kList to {}
try
set fldrs to do shell script "ls /Volumes | grep BasicSkillsData"
on error errMsg number errNum
if errNum is 1 then error number -128 -- exit script
display alert ("Error # " & errNum) message errMsg buttons
{"Cancel"} giving up after 30
end try
try
repeat with x from 1 to count of fldrs
set end of kList to POSIX file ("/Volumes/" & paragraph x of
fldrs & "/")
end repeat
tell application "Finder"
move kList to trash
-- empty trash
end tell
on error errMsg number errNum
display alert ("Error # " & errNum) message errMsg buttons
{"Cancel"} giving up after 30
end try
--> Cut <--
--
You can get more with a simple prayer and a Thompson
sub-machinegun than you can with a simple prayer alone. -John Dillinger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden