Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stephenbakertv

macrumors newbie
Original poster
Apr 28, 2016
1
0
Hi,
I want to know when a hard drive is added to my work Mac, ie get an email or text when one of my workers mount a hard drive to our work computer. Then I can remote log in and go to work. There was an App called Growl but apparently this ability is part of Mac OS.....Any ideas?
 
Hi,
I want to know when a hard drive is added to my work Mac, ie get an email or text when one of my workers mount a hard drive to our work computer. Then I can remote log in and go to work. There was an App called Growl but apparently this ability is part of Mac OS.....Any ideas?

This sounds like a job for a Folder Action.

Open the Automator app and choose "Folder Action" as the type of workflow. At the top of the workflow, select "Other..." where it says "Folder Action receives files and folders added to". In the choose folder dialog box that pops up, press cmd+shift+g and go to /Volumes. Click "Choose".

Then, add a "Run Applescript" item and copy in the following script (changing your name and email address at the top):

Code:
on run {input, parameters}
    set myName to "Your name here"
    set myEmail to "your.email@domain.com"

    set theDrive to "none"
    repeat with f in input
        display notification "Drive mounted: " & (POSIX path of f)
        set theDrive to (POSIX path of f)
    end repeat
   
    -- Uncomment next 3 lines to only send an email for a particular drive
    -- if theDrive is not "/Volumes/Backups" then
    --    return
    -- end if

    tell application "Mail"
        set theMessage to make new outgoing message with properties {subject:"New drive mounted", content:"The following new mount has been detected: " & theDrive, visible:true}
        tell theMessage
            make new to recipient with properties {name:myName, address:myEmail}
            send
        end tell
    end tell

end run

Save the workflow and you should be done. It will run automatically whenever a drive is plugged in.
 

Attachments

  • workflow.png
    workflow.png
    267.3 KB · Views: 96
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.