Re: AppleScript to erase one mounted volume if it's modification date is date is greater than one day?
Re: AppleScript to erase one mounted volume if it's modification date is date is greater than one day?
- Subject: Re: AppleScript to erase one mounted volume if it's modification date is date is greater than one day?
- From: Kaydell Leavitt <email@hidden>
- Date: Thu, 20 Jun 2013 15:52:00 -0600
Jim,
Here is a script that solves part of the problem.
This AppleScript uses the shell command "diskutil" to erase a whole volume.
It seems to work, I tested it on a disk image that I created with the "Disk Utility.app" application that comes with OS X.
-- Kaydell
-- This script is an example of how to erase an entire volume quickly in AppleScript by calling
-- the shell command "diskutil"
tell application "Finder"
launch
set temporaryDrive to "TemporaryDrive"
display dialog "Warning!!! This script will erase the volume called " & temporaryDrive & " are you sure that you want to do this?"
do shell script "/usr/sbin/diskutil eraseVolume HFS+ " & temporaryDrive & " /Volumes/" & temporaryDrive with administrator privileges
end tell
Let me know what you think. email@hidden
-- Kaydell
On Jun 20, 2013, at 2:22 PM, Jim Kessler <email@hidden> wrote:
> Here's the scenario: a Mac with a hard drive is partitioned into two volumes, one of which is the startup drive (Macintosh HD). The second volume (Temporary Drive) holds data files which are non-critical. I'd like to compose an AppleScript that compares (running at startup, through a login item) the current date to the modification date of the second volume, and erases the second volume if the modification date is more than a day (or 24 hours, or whatever measure of time necessary) older than the current date. Is this easily accomplished through AppleScript? (Running 10.8.4.)
>
> Thanks!
> Jim
> _______________________________________________
> 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
_______________________________________________
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