Folders with .DS_Store

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

Moderator: Mr_Noodle

Folders with .DS_Store Wed Sep 28, 2011 10:19 pm • by cxhamilton
I have a rule that is supposed to remove empty folders when:

  • Kind is Folder
  • Number of items is 0

According to the Hazel Release Notes:

Version 2.0 (Aug 2, 2007)

  • Now ignores all invisible files (including dot files) when processing a folder.
  • When calculating sizes of files in a folder, will ignore invisible files. So a folder can be considered empty (size = 0) even if it has files like .DS_Store in it.

That said, Hazel is not removing the directory when a .DS_Store file is the only file in the directory. I have confirmed that the ScanInvisibles hidden preference is not set -- I have also tried ScanInvisibles -bool NO. As soon as I manually remove the .DS_Store file, the criteria is satisfied. Any suggestions?

I am running Hazel 2.3.9 (v691) on Lion 10.7.1.
cxhamilton
 
Posts: 4
Joined: Wed Sep 28, 2011 9:57 pm

Re: Folders with .DS_Store Thu Sep 29, 2011 11:11 am • by Mr_Noodle
"Number of Items" is something recorded by Spotlight, not Hazel, so I have no control over how that is calculated.

For size calculations, invisible files are included. I did this since in some cases, important data is stored in invisible files so I didn't want the folder to be considered empty in those cases. Also, it makes the calculations consistent with what Finder reports so there's less confusion.

That said, .DS_Store is a particularly annoying case and I don't think people would miss those. I'll consider having the size calculations ignore those files.
Mr_Noodle
Site Admin
 
Posts: 11280
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Folders with .DS_Store Thu Sep 29, 2011 1:39 pm • by cxhamilton
I understand what you're saying, but it reads contradictory (based on my understanding) to the Release Notes -- which is why I asked the question.

  • So a folder can be considered empty (size = 0) even if it has files like .DS_Store in it

I suppose that I could add a rule to the folder to remove dot files/.DS_Store. Then my remove empty folders rule would clean up on the next pass.
cxhamilton
 
Posts: 4
Joined: Wed Sep 28, 2011 9:57 pm

Re: Folders with .DS_Store Thu Sep 29, 2011 2:05 pm • by Mr_Noodle
Actually, looking at the code, the release notes are correct. Have you tried using size instead of number of items?
Mr_Noodle
Site Admin
 
Posts: 11280
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Folders with .DS_Store Fri Sep 30, 2011 10:30 am • by Mr_Noodle
Thinking about it some more, I think I'm going to change the size calculations. I think it's more important to be consistent with Finder so I'll probably change it in the current 3.0 beta to not ignore hidden files. That said, I'll look into making an exception for .DS_Store because they seem to universally annoy everyone.
Mr_Noodle
Site Admin
 
Posts: 11280
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Folders with .DS_Store Sun Oct 02, 2011 8:25 pm • by cxhamilton
Mr_Noodle wrote:Actually, looking at the code, the release notes are correct. Have you tried using size instead of number of items?


I have with no success. The .DS_Store file size is variable and unpredictable. Remove all other files and the folder is the same size on disk as the .DS_Store file.
cxhamilton
 
Posts: 4
Joined: Wed Sep 28, 2011 9:57 pm

Re: Folders with .DS_Store Sun Oct 02, 2011 8:31 pm • by cxhamilton
Mr_Noodle wrote:Thinking about it some more, I think I'm going to change the size calculations. I think it's more important to be consistent with Finder so I'll probably change it in the current 3.0 beta to not ignore hidden files. That said, I'll look into making an exception for .DS_Store because they seem to universally annoy everyone.


I agree with you 100%.

The reality is that I can accomplish my goal with a series of rules. I was just looking for an easier way to do more with less.
cxhamilton
 
Posts: 4
Joined: Wed Sep 28, 2011 9:57 pm


Return to Support

cron