File Sorting & Subfolders, & Pattern Matching

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

Moderator: Mr_Noodle

File Sorting & Subfolders, & Pattern Matching Sun Jul 24, 2016 3:33 pm • by oyoyoba
Hi,

Brand new to Hazel, am having a really difficult time understanding how to make this work- so, please help if you can! If there is also a detailed manual for Hazel please point the way. I have tried the kb/forum search results and Hazel app help functions.

What I'm trying to do is sort files (doc/x and ppt/x or pdf) into folders with the appropriate lecture number.
so
Code: Select all
file1.doc
file2.doc
pres1.ppt
pres2.ppt
==>
lecture1/file1.doc
lecture1/pres1.doc
lecture2/file2.doc
lecture2/pres2.doc


I've tried to explain it more below...if the above is too vague
1. Download and unzip of folder from school.edu
Code: Select all
=> mylectures.zip ==> mylectures (folder)
Have Hazel use school.edu URL to unzip only similar archives
Have Hazel do something?? so that it knows to apply following rules to mylectures (folder)

2. Have Hazel apply rules to mylectures (folder) contents

3. If file is a docx
Get the lecture # and sort into subfolder
Code: Select all
"23ww Random Topic A ProfZ.doc" ==> folder structure
Lecture23ww/23ww Random Topic ProfZ.doc
"#ww" is always in the original file name

4. If file is a pptx or pdf
Move the paired ppt to the correct lecture folder
Code: Select all
 "Random Topic A ProfName.ppt" ==> folder structure
Lecture23ww/Random Topic A ProfName.ppt
The .ppt document title should match either part of the .doc filename or a phrase inside it (verbatim)
--i.e. "Random Topic A" or --ProfZ
"23ww" may/may not be in the original title

What I (think) I understand about Hazel
1. Hazel monitors folders, so you have to explicitly tell it to act on folder contents
2. Rules are performed in order, so from the preference pane all ticked rules will run in sequence(?)
3. There is not a way to have custom token available to all rules in a folder (i.e. make once ==> can use in any Hazel rule)
4. There is a way to get Hazel to match part of a filename (but can it isolate a portion and use it for folder renaming?)
oyoyoba
 
Posts: 1
Joined: Sun Jul 10, 2016 2:18 am

I'm a bit unclear on how the ppt file gets the lecture number but to address your questions:

1. Hazel does not go into subfolders by default. You have to create a separate rule to do that as described here: https://www.noodlesoft.com/kb/going-into-subfolders/

2. Rules are evaluated in order. The first to match is the one that gets executed unless you add the "Continue" action to the rules.

3. No way to do this though you can add it to the file's comment and extract it from there later. You may want to describe why you need to do this.

4. Do you mean have the whole pattern match a part or have an attribute match a part. The answer is a bit different depending on the answer though I suspect you probably need to use the "anything" token to match the parts you don't care about.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support