Skip navigation

Add Service to unlock folder/files

1348 Views 4 Replies Latest reply: Mar 6, 2013 8:00 PM by pjdube RSS
phillio Calculating status...
Currently Being Moderated
Feb 17, 2011 9:57 AM
Hi - I'm trying to add a Service (using Automator) that would allow you to unlock all the files in a selected folder and having an issue with limiting the scope of the action to that folder.

In Automator, I've created a new Service called Unlock Files. It's set to receive Selected Folders in The next step runs a shell script, "chflags -R nouchg ./"

This results in my entire drive being unlocked, not just the folder in question when I run that service in the Finder.


Mac Pro, Macbook, Mac OS X (10.6.6)
  • Camelot Level 8 Level 8 (45,670 points)
    Currently Being Moderated
    Feb 17, 2011 10:15 AM (in response to phillio)
    The next step runs a shell script, "chflags -R nouchg ./"

    Sure. That command, as written, will do precisely what you say. There is nothing in the shell command to indicate which folder(s) to work on.

    You need to actually pass the folder(s) from the previous step into the shell command.

    You need to use the popup menu in the upper-right corner of the run shell command action to change your shell action to take the inputs as arguments rather than the default as stdin. This will essentially rewrite the shell command to loop through the arguments, running the chflags as appropriate:

    for f in "$@"
    chflags -R nouchg "$f"
    Mac OS X (10.6.5)
  • Camelot Level 8 Level 8 (45,670 points)
    Currently Being Moderated
    Feb 17, 2011 11:40 AM (in response to phillio)
    but are you saying that all I have to do is change the pulldown to 'arguments' instead of 'stdin' (and I would love to know what stdin is)? Or do I have to change the shell command to your example as well?

    You'll have to change the script, too.

    The bulk of the re-written script is just a loop that iterates through the items passed in as arguments, running the chflags command for each item (there could be more than one).

    As for stdin vs arguments, some shell commands can take their input from the command line and process them - this is what happens, for example, when you pipe some data through grep - the output of one command (stdout) becomes the input data for the next (stdin).

    In this case, chflags doesn't care about stdin since it expects all its data to be passed in on the command line, hence the need to pass the data as arguments.
    Mac OS X (10.6.5)
  • pjdube Level 3 Level 3 (830 points)
    Currently Being Moderated
    Mar 6, 2013 8:00 PM (in response to phillio)

    Hey Phil,


    Here is the Automator action you need. It's called "Unlock Finder Items" You can get it from here:



    There is a Finder Automator Action pack that you can purchase (really cheap) to get this action and about 20 other awesome actions.


    See below service:


    Screen Shot 2013-03-06 at 9.54.19 PM.JPG


    I tested it and it works great.


    Good luck!






More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.