I discovered that the mounted volume of DMG archives of software distributions created on Leopard (which I'm not using yet; still @10.4.10) often (always?) contains a locked/hidden/empty .HFS+ Private Directory Data^M (yep, that's a trailing control-M) directory in its root, possibly a leftover from the FSEvents daemon since there's also a .fseventsd directory there. When copying the root directory from the mounted volume the locked directory comes along with it, which has unwanted side effects such as not being able to expunge Trash while it contains the locked directory.
Enter Hazel:
I'd like to construct rules/actions to unlock those .HFS+* droppings. So far I've managed to get Hazel monitoring my ~/.Trash folder using a single rule with a "Kind is Folder" condition and "Run rules on folder contents", "Run Shell script <name>" actions. The script is essentially this one-liner:
- Code: Select all
find . -name '.HFS+ Private Directory Data*' -exec SetFile -a l {} \;
The file path argument passed to it is unused.
This seems to work okay but since I'm not satisfied with this as a long-term solution I'm soliciting suggestions for ways to optimize both the script and how Hazel invokes it… or replace it with something more elegant, which leads into:
One issue is that Hazel doesn't seem capable of matching dotfiles directly. A lesser one is no built-in (un)lock action which would eliminate need for a script. Lastly, there's no way to specific (AFAIK) the single Trash "pseudo-folder" that includes trash folders from other volumes.
A more ambitious project is to get rid of that locked .HFS+* directory whenever it shows up where it doesn't belong because it causes trouble when moving the parent folder or replacing a folder that already contains it. I don't mind quarantining where the first instance of .HFS+* will be when its copied from a mounted dmg volume, letting Hazel do unlocking/deleting there and superseding the need for the Trash unlocking method. I just started with the latter because it was easier/safer with my current lack of experience with Hazel.
Hopefully that makes sense and covers all the relevant details. Thanks in advance for any suggestions!