Félix Chénier PhD

Divers

ToggleLock : Finder script to recursively lock files on macOS

Publié le 2016-12-06

UPDATE: See new version

Locking files is one of the best way to prevent accidentally overwriting them. If you right-click on a file in Finder and select Get Info, you can check the "Locked" attribute in the file's general information.

It would seem logical that if you lock a folder, then all its content also becomes locked. However, this is true only for the files in that folder, but not for those in subfolders. In other words, the directory locking is not recursive. This is obviously a serious issue because you may think a file is locked while it is not, and then overwrite it without knowing it is even possible.

Since I'm quite freak in data integrity and I cannot understand why macOS developers chose this behaviour, I've wrote a Finder script that ensures that when you lock a directory, all its content, including subdirectories, is also locked.

Installation

  1. Download and unzip this small application somewhere on your computer.
  2. Drag the application from where you just saved it to the Finder toolbar.
  3. A nice lock icon is now present in your Finder toolbar.

Usage

To lock a file or folder, select it in Finder, then click the lock icon on the toolbar.

To unlock a file or folder, select it then click again on the lock icon.

Please contact me if it works or not for you (my coordinates are on the front page).