Copy entire contents and structure of folder based on kind

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

Moderator: Mr_Noodle

Ok, I did try reading as many of the pinned posts, and Help, and searching, but this simple task is still eluding me.

Given Monitored folder: Downloads
Given Target folder: Downloads\1FONTS
Given file Kind: TrueType Font (TTF)

The goal is:
- IF the Monitored folder root contains file of desired Kind: Move to Target folder. <-- easy peasy
AND
- IF a Subfolder Structure of Monitored folder contains AT LEAST file of Kind, Move Subfolder Structure and ALL of its contained files to Target folder. (I.e. not just the Kind (TrueType font) used for detection. They usually include a license file, sometimes examples, images, etc.)

Ex:
- Downloads\font1.ttf -> 1FONTS\.ttf <-- no problem
- Downloads\
----SomeFontPackage -> 1FONTS\SomeFontPackage (and all files and folders below it)
-------License.txt
-------TheFontFolder
-----------font2.ttf

- I can do the root Monitored folder files of Kind, no problem.
- I can grab *just* the files of Kind, and move their directory structure, into FONTS fine. The problem arises with the associated files in the structure.

The closest I've gotten is the rule below, which I created reading the Nested rules documentation. (Before, I had tried various combinations of "Go into subfolders" but never seemed to get it right. Either I matched nothing, matched all folders, and just made a general mess of things. :) )

So I hope I've done my homework, and didn't miss some clearly similar question asked somewhere. I appreciate any and all help! :) (And yep I'm in Demo mode while I make sure Hazel can do what I'm after. I'm certain it can one way or another, but I want to be double-double sure before I license it for several computers.)

Image
(Image link doesn't seem to be populating so I'm posting a separate link here: https://www.dropbox.com/s/ut5140w861z6t ... -adfja.png
rgoodwin
 
Posts: 4
Joined: Tue Jul 10, 2018 10:36 am

That rule looks ok to me. Use the preview function to test it out if it isn't working.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:That rule looks ok to me. Use the preview function to test it out if it isn't working.


Tried to record a screencast of an actual run,linked below. (And I don't mind if it messes up the folder too much anyway.) The only folder it should be processing is the first one you see in the list (I moved it up there for visibility), and I put a font right up there in the list in the Downloads root directory itself. (Verified the Kind is TrueType Font by using Get Info on it.)

https://www.dropbox.com/s/ug04k8k3zbt2a ... t.mp4?dl=0

You'll see:
- Processing starts
- the "backspacer" folder is moved, as expected, with all files
- the "social_font" file is NOT moved
- I'm not sure why the Abort message showed up, I do see that from time to time but not sure it's an issue/related
- Run finishes

Preview window doesn't show the "social_font" matching either.

So it's mostly there, my previous report actually apparently had it backwards...the subfolders work, but not the file in the root folder itself. Presumably that's still an easy fix I'm missing. I can always just make a second rule after I purchase (along with the other rules), but I feel like that might introduce complication if I end up turning on "Go into Subfolders" at some point.

Thank you for your support and patience!
rgoodwin
 
Posts: 4
Joined: Tue Jul 10, 2018 10:36 am

Wait, is that the only font related rule you have? If so, it won't move the font files, just folders containing font files. You'll need to either add a condition to that rule to match those or create a separate rule.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Correct; since I was misreading what was happening, that was the extent of the rule.

I'd like to add conditions into that rule so it's all in one, but I can't quite figure it out at the moment. I was in the process of adding a separate rule to deal with just the "monitored folder" fonts:

ALL OF
- Kind IS NOT Folder
- Nested
--- ANY OF - current file or folder
------Kind is TrueType
------Etc etc (other font types)

It definitely works, and "Go into Subfolders" doesn't seem to mess with it. (I'm guessing since I set "Kind is NOT folder", it just skips this rule.)

I would definitely love to put it all in the same "Fonts" rule, in a way that I can also have "Go into Subfolders" turned on (for other unrelated rules) without conflicting. I think I can change the rule order for "Go into Subfolders" wouldn't process the "Fonts" rule, but like you said I should probably be able to do it "all in one" anyway. And it would probably teach me everything I need to know to start setting up all my rules at that point. Just can't grok it :) So, hints welcome!

(P.S. Already decided to purchase today, based on the amazing functionality AND support!)
rgoodwin
 
Posts: 4
Joined: Tue Jul 10, 2018 10:36 am

You need another level of nesting. I'm not sure if the Name or Date Last Opened conditions apply to single files so I'll omit them to focus on the main part.
Code: Select all
    If (all) are met
        If (any) are met for (the current file)
            Kind is TrueType
            Kind is OpenType
            ...
            If (any) are met for (any of its subfiles)
                Kind is TrueType
                Kind is OpenType
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Facepalm.

I didn't think about nesting like that. You'd think I've written enough horrible spaghetti for loops to instinctually do that. :)

Thank you! (And happy 5 pack owner now!)
rgoodwin
 
Posts: 4
Joined: Tue Jul 10, 2018 10:36 am


Return to Support