|04-02-2012, 08:41 AM||#1|
Please Help- Login Script
I was hoping somebody would be kind enough to help me out. I am new to AppleScript and am terrible with programming. I just started a new position in a school environment and am working on learning scripting, however I am on a deadline and am having a rough time figuring out how to put the script together. I have read that I might need to use shell commands to run this which is causing a great deal of confusion.
So basically, I need the script to:
1. Log in automatically when computer is not in use
2. Launch script
3. Check non administrator user folder for files not modified within the last seven days
4. If older then 7 days delete without needing password each time
5. After delete empty trash
6. Exit script
7. Restart computer
The machines are running AD and OD if that makes a difference. I have created a script to delete the folders after 7 days of no modification in one user, and believe I can just remove the specific user for it to run on all the users (didn't want to mess up the machine without knowing for sure that I can do this)
Any help would be greatly appreciated.
Thanks for any help you can provide,
What I have:
tell application "Finder"
delete (every item of folder "Users:test" of startup disk whose modification date is greater than ((get current date) - 7 * days))
|04-02-2012, 01:55 PM||#2|
Join Date: Apr 2005
This would all be accomplished much easier with straight shell scripts, rather than AppleScript. A shell script that is set to run via launchd or cron would not require a user to be logged into the GUI.
Google for bash scripts that perform the 7-day delete function that you want to do. The Unix FAQ on this forum will get you set up on how to write bash scripts and make them executable. Some additional Googling for how to automate script exeuction via launchd or cron will be the last part.
|Display Modes||Rate This Thread|