Applescript to Change File Permissions

Discussion in 'Mac Programming' started by hfthomp, Oct 25, 2012.

  1. hfthomp macrumors member

    Apr 8, 2008
    Hello everyone, I have what I hope is an easy question that I just can't find the answer for...

    I have a folder under the /Users/Shared/Pictures on my hard drive. This folder contains Lightroom catalog files and other things. When I create a new Lightroom catalog from my account I save it there. My wife has a user account on the same computer and she likes to be able to the pictures I save into Lightroom. In order to do this, I have to change the permissions on the file everytime.

    Right now, my process is read pictures onto computer, import them into a newly created lightroom library (if needed), then using the terminal change the file permissions of the top Pictures folder so that she can read and write to everything in there.

    I was wondering if there is a way to create an AppleScript that would allow me to have an icon on the desktop that I could click and then have it automatically go and change the permissions on this folder.

    Is that possible? Thanks.
  2. kryten2, Oct 25, 2012
    Last edited: Oct 25, 2012

    kryten2 macrumors 6502a

    Mar 17, 2012
    Try this :

    set thePath to "/Users/Shared/Pictures"
    set theResult to button returned of (display dialog "This will change permissions on the " & thePath & " folder." with title "Change File Permisssions" buttons {"Cancel", "OK"} default button 2)
    if theResult is "OK" then
    	set theCommand to do shell script "your terminal command here eg chmod " & quoted form of thePath
    end if
    -- or without the dialog
    		do shell script "your terminal command here eg chmod " & quoted form of thePath
    Save as an application and put it on your desktop or drag it into the Finder Toolbar.

Share This Page