Number of Files in Folders and Subfolders

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

Moderator: Mr_Noodle

Number of Files in Folders and Subfolders Fri Aug 18, 2017 12:21 pm • by Uhlhorn
Hi,

I want to set a tag if the folder contains no files, but empty folders.

My folders have subfolders, and in the subfolders there are document files (or not).

My rule should tag the folder „green“ if there is no document within the folder structure available.
And set it to „red“ if there is any kind of document in a subfolder of the folder.

How can I solve this problem?
Uhlhorn
 
Posts: 5
Joined: Fri Aug 18, 2017 11:56 am

Re: Number of Files in Folders and Subfolders Mon Aug 21, 2017 10:39 am • by Mr_Noodle
You can use the sub-file count attribute for this. Note that the folder has to be under the monitored folder for a rule to match it.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Number of Files in Folders and Subfolders Mon Aug 21, 2017 11:11 am • by Uhlhorn
Note that the folder has to be under the monitored folder for a rule to match it.
Yes, and this is the problem! ;-)

I have a monitored folder. In the monitored folder are subfolders. And I want so set a coloured tag to mark the subfolders. Red if one ore more file are within folders, green if there are no files in. And this subfolder has subfolders too.

But I have found a solution for this:
I check the folders with an Applescript (Passes AppleScript)(embedded script)

Code: Select all
set root_fol to theFile

tell application "Finder"
   set files_ to count files of entire contents of root_fol
end tell

if files_ is 0 then
   return false
else
   return true
end if


Image
Uhlhorn
 
Posts: 5
Joined: Fri Aug 18, 2017 11:56 am

Re: Number of Files in Folders and Subfolders Tue Aug 22, 2017 10:37 am • by Mr_Noodle
Have you tried using the "Sub-file/folder count" attribute for this? It should work.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support