Deleting .DS_Store files in Folder and Subfolders

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I need the following:

Delete all existing and newly appearing ".DS_Store" Files in a folder located at "/Volumes/Archive/.rdbackup/" and all of its sub folders.

Background: I want it to delete .DS_Store files as soon as they get created when I browse into the folder with Finder.

It seems that I can't find a rule which matches ".DS_Store" at all?

In addition I wonder why there is no "delete file not using the trash" in Hazel?
OderWat
 
Posts: 3
Joined: Fri Oct 19, 2012 9:23 am

Hazel, by default, ignores invisible files. In the Tips forums is a sticky article about hidden defaults which shows you how to get Hazel to start scanning invisible files.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you for telling me about that trick.

Actually I think this should be exposed in the GUI per Path "Scan inivibles" or not. This is what I was searching :)

I applied the setting and added the two rules from the screens here:

1. Recurse the folder: http://d.pr/i/VUs9
2. Trash .DS_Store files: http://d.pr/i/Gyyj

That does what I want but seems to create to much overhead to be usable for me. There are thousands of files and folders in the sub folders of my .rdbackup folder and checking the log hazel is scanning for minutes till it is through all of them.

Is there something I could do to optimize this?

The "Date Added is after Date Last Matched" will not help me as far as I understand how that works.

Actually I wonder if there could be an action which just triggers for newly created files in a sub path. Kinda like the App "Trickster" finds it files and then applying rules on it when they match. Was that being considered already for Hazel?

Just read about FSEvents (https://developer.apple.com/library/mac ... rence.html) and believe that could work for Hazel... or do I miss something?
OderWat
 
Posts: 3
Joined: Fri Oct 19, 2012 9:23 am

Hazel does use FSEvents. That's how it's triggered. But it doesn't tell you what file has changed so Hazel has to scan to find out. That said, there are some optimizations to be done but for the moment, it is going to be resource intensive.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Hazel does use FSEvents. That's how it's triggered. But it doesn't tell you what file has changed so Hazel has to scan to find out. That said, there are some optimizations to be done but for the moment, it is going to be resource intensive.


Yes I figured that it uses this mechanic (there is not really another one). But it is not using this for matching sub folder actions. The ineffective part of "my" rules is the subdirectory scanning. After some programming I did myself I found it is very much possible to trigger an action for the .DS_Store creation by watching the volume and checking the existence of an ".DS_Store" file in the triggered (filtered) sub directories.

Hope you will implement something like that soon as I was just doing some quick and dirty programming and would love to do this in Hazel :)
OderWat
 
Posts: 3
Joined: Fri Oct 19, 2012 9:23 am

Understand there's a world of difference between a quick and dirty approach and doing it for production. It is on the feature list but it will take some time to do properly. While you can do it in your case, keep in mind there are tons of other cases it has to not break and work with.

It's important to me personally, but it will take some time to do. Probably not in a maintenance release, but very likely in 3.1. Hopefully after the next maintenance release (3.0.14), things will settle down so I can get some heads down time with 3.1. Also, keep tabs on the beta forum as I'll probably do some sort of beta testing for it.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support