How to search for all locked files in a folder with subfolders

I used an automated workflow below as noted, but it returns errors. I would like to determine the names of locked files within multiple sub folders. Here is the error I receive:

Service failed. Couldn’t open the selection, followed by this error message:

The action “New TextEdit Document” encountered an error: “Could not return new TextEdit document”


Here is the workflow provided:


After opening Automator, choose New Document.

Select a Service as the workflow type.

At the top of the window, set Input receives to Folders in the Finder.

From the Library on the left, open Utilities.

Drag the Run Shell Script action into the pane on the right.

Replace the contents of the Shell Script with:

find "$@" -flags uchg

Set Pass Inputs to Arguments

From the Text category, drag in a New TextEdit Document.

Save the Service with a short, but descriptive name.

Close the workflow and Quit Automator.


To use the Service, ctrl-click (or right-click) on a folder in the Finder.

From the Services submenu, select the Service you just created.

A TextEdit document will open with the found files listed with their full file path.


Any help will be appreciated. Thanks, Scott

Posted on Apr 21, 2018 4:15 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 22, 2018 4:14 PM

As an experiment, try this

User uploaded file


Basically, I'm having the output from the 'find' command redirected into a tmp file


Then I'm using the 'open' command to launch TextEdit (the default app for .txt files).


If this does not work, you can actually look at /tmp/tmp.txt to see if there are any errors inside of it.


If it still complains about TextEdit, then try opening in a different app. For example Safari. You can do this by adding -a Safari to the 'open' command as below.

User uploaded file

Bottom line is that what you are doing should work. Why it doesn't work, I do not know, but I suspect it is something about your system, I just don't have a clue about what it could be.

Similar questions

6 replies
Question marked as Top-ranking reply

Apr 22, 2018 4:14 PM in response to Scotttt

As an experiment, try this

User uploaded file


Basically, I'm having the output from the 'find' command redirected into a tmp file


Then I'm using the 'open' command to launch TextEdit (the default app for .txt files).


If this does not work, you can actually look at /tmp/tmp.txt to see if there are any errors inside of it.


If it still complains about TextEdit, then try opening in a different app. For example Safari. You can do this by adding -a Safari to the 'open' command as below.

User uploaded file

Bottom line is that what you are doing should work. Why it doesn't work, I do not know, but I suspect it is something about your system, I just don't have a clue about what it could be.

Apr 22, 2018 6:24 AM in response to Scotttt

OK, I repeated my experiment as a Service, hopefully following your instructions correctly

User uploaded file

I then went to the Finder, and did a Control-Click (Right-Click) on a folder where I had Locked files, and selected Find_locked_Files_experiment (what I named my Automator Service)

User uploaded file

And this is the TextEdit document that popped up on my screen (I did edit my real username to 'me', but otherwise this is exactly what was displayed)

User uploaded file

So I do not know what errors you are seeing, but it does not happen on my system.


Assuming your Automator Service workflow looks identical to my screen shots, then you could try


1)

Create a new account. Does the Automator Service workflow behave correctly, or give you the same results?

System Preferences -> Users & Groups


2)

Try booting into Safe mode

<http://support.apple.com/kb/ht1564>

This will not load any 3rd party additions, it will load some more conservative Apple drivers (may cause screen flicker), and it will clear some kernel caches (a cache is saved data in a form that can speed up a program, but is totally redundant to the original source, and thus can be safely cleared). Booting into Safe mode is just an experiment, but can frequently eliminate any 3rd party interference, or a cached item out-of-sync with the world. (Verify Safe mode via Applications -> Utilities -> System Information -> Software -> Boot Mode -> Safe vs Normal)

Apr 22, 2018 6:06 AM in response to Scotttt

How/where are you dragging the folder with the locked files?


I saved my Automator workflow as an application (not a service).


Using the Finder, I did a Click-and-Drag on a folder of interest, dragged it to my saved Automator workflow as an application, and released it.


If you used this a lot, you could put the Automator workflow application on your Dock, or your Desktop, or as a Finder Side-bar item, or Finder -> View -> Customize Toolbar.

Apr 21, 2018 10:20 PM in response to BobHarris

Well no, I was doing it as described in the original post. I right click on the folder with locked files, then select the automator file under services and get the following error messages. The automator script is as you show it in your screenshot.

User uploaded fileUser uploaded file

Thank you though for your response and test. How/where are you dragging the folder with the locked files?

Apr 22, 2018 8:31 AM in response to BobHarris

Good morning Bob, thank you so much for all your correct advice. I can see this should work but there is something not working on my system. I tried all your suggestions, Safe Mode and New User, each of which returns the same error results. I also created the script as an application, again with same error results. The only difference is that the workflow or application script between our two screenshots in yours the service is in Finder and in mine it is in Finder.app. My system is a Mac Pro (Late 2013) running 10.13.4. Your results are exactly what I need, just don't know what is causing the issue in my system.

User uploaded file

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to search for all locked files in a folder with subfolders

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.