Set view settings for many folders at once

I have a large number of folders which I'd like to all be displayed with certain columns in a certain order.

I've tried copying the .DS_Store file from a folder that's set up correctly to a folder that isn't, but it doesn't seem to work. (Do I need to log out or something for it to take effect?)

Please note that I do not want to use this as a default layout for all Finder windows.


Solution 1:

Yes, what you are trying to do is possible. I've been down this rabbit hole deep, trying to code a CLI tool by manipulating the .DS_Store files directly using the reverse-engineering done by Perl coders over at CPAN (https://metacpan.org/dist/Mac-Finder-DSStore/view/DSStoreFormat.pod). I gave up this route because every version of macOS has differences in the format, and nothing has official documentation and the unofficial one is incomplete AFAIK.

What will work, across macOS iterations, is using Automator.

I will make a fundamental assumption, and that is that your large number of folders either is or can be [temporarily] put in a single master folder. Let's call it /Users/me/TEMPLATE. If not, and your folders are scattered around in some other way, you first need to compile a list of those paths. This list can then be used to script temporarily moving all the folders to TEMPLATE and then move them back. Or, perhaps by using Finder aliases or posix symlinks to avoid actually moving the folders. Ufortunately, macOS will not allow you to create hard links to folders. That would be easiest, but is disallowed to avoid infinite recursion. You can work around this mounting your file system on linux if you want.

Using Automator:

  1. Open your TEMPLATE folder in Finder, which now one way or another contains all your folders you want to change the view for.

  2. Set the view to "LIST" view, and rearrange everything in this view according to your desires.

  3. Hit CMD+J for View options, then check "Always open in List view". Close this info box.

  4. Open Automator, hit CMD+N, new Workflow

  5. Drag in the action Get Specified Finder Items

  6. Drag your TEMPLATE folder in to the Get Specified Finder Items action

  7. Drag in the action Set Folder Views under the first action

  8. You see these two actions are now connected. The metadata from the TEMPLATE folder is now inherited to the Set Folder Views UI.

  9. There is even more metadata passing through here than what the developers of Automator has made UI elements for. You have to experiment to see. Most importantly, do check the box for [X] Apply Changes to Subfolders.

  10. Run the workflow by hitting CMD+R.

This will propagate your view to all the subfolders. You might need to move your set of folders back again if you temporarily scripted moving them. If you do, please take note that which tool you use to alter macOS file systems do so in different ways. The Finder is the most compatible, either manually or scripted with osascript or Automator. From the command line, using an updated version of rsync is very flexible using the right flags. Do some tests first to see whether you can use mv, cp, or ditto on Folders directly and whether those successfully also moves over your ds_store metadata accordingly or not!

Make a backup first! :)