Page 1 of 1

Sorting QuickTime files into subfolders by year and month

PostPosted: Mon Apr 23, 2018 12:37 am
by ericwass
Hi,
I've looked all over these boards and see a lot of people are asking similar questions but I haven't found the answer I'm looking for. Basically I have videos of my kids dating back to 2009 sitting on an NAS drive that I want to re-organize. Originally I used Hazel to sort these quicktime files by renaming by the date created and the camera used and then creating a subfolder with a name based on the date Hazel processed them and put them on the NAS drive. Why I thought I'd want the files organized this way is a little beyond me at this moment. In any case, what I need help with is finding a way to get Hazel to dive into hundreds and hundreds of folders and subfolders, pull out the QuickTime files and sort them into top-level folders based on year and then subfolders based on month. Ideally, Hazel would create the folder / subfolder if it didn't exist (I.e. it fishes out a QT file that was shot in November of 2010, creates a top-level folder called 2010, then a subfolder called November and puts the file in it) and, of course, not duplicate the folder if it does exist. Is this even possible? Thanks for any guidance you all can give me.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Mon Apr 23, 2018 12:19 pm
by Mr_Noodle
Search the help for "subfolders" as there is a chapter that is devoted to the topic.

To sort by date, you can use the Sort into subfolder action. Just use a date attribute in the pattern. You can format the date however you want, including excluding parts of the date.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Mon Apr 23, 2018 2:50 pm
by ericwass
Thanks for the tip. I had read the subfolders chapter here https://www.noodlesoft.com/manual/hazel/advanced-topics/processing-subfolders/. My problem isn't so much recursively sifting through subfolders it's the second half: identifying the capture (or file creation) date, finding the appropriate folder / subfolder on the top level to put the files into and, if they don't exist, creating them. I feel like custom tokens are going to be the key here (https://www.noodlesoft.com/manual/hazel/attributes-actions/attribute-reference/using-custom-attributes/) but I just can't get my head around how to effectively do what I want here. Any further guidance you could offer would be welcome.
Thanks.


p.s. this is a sample of what it looks like currently. In this example the filenames have a description of what the subject is (something I started doing recently) but most older ones don't. Most have some sort of date stamp created by Hazel in the filename but some don't. It's a bloody mess.

Image
Mr_Noodle wrote:Search the help for "subfolders" as there is a chapter that is devoted to the topic.

To sort by date, you can use the Sort into subfolder action. Just use a date attribute in the pattern. You can format the date however you want, including excluding parts of the date.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Tue Apr 24, 2018 12:17 pm
by Mr_Noodle
Check out the different date attributes available. Note that Hazel does provide a "Date taken" available when you select "Other" in the attribute pop-up. Once you have that, you can use that in a Sort into subfolders action.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Tue Apr 24, 2018 6:59 pm
by ericwass
So I've figured out the bulk of it but there are three issues still plaguing me.

Issue 1: Keep one set of dated subfolders. I want to keep these new dated subfolders at the root level of the existing folder. When Hazel searches inside existing folders and subfolders for video files it's easy enough to have a rule that moves the file to the root level first and then either creates a dated folder there or, if a matching one already exists, moves the file into it. However, that rule encounters an error when it comes upon video files that are already at the root level and not in any kind of pre-existing subfolder. Hazel can't move them to the root level first because they're already there. My solution has been to create a temporary holding folder to which Hazel moves ALL video files it finds (both at the root and in pre-existing subfolders). It then moves them out of that subfolder and back to the root level and finally creates a new dated subfolder or moves the file into an existing one. This seems wildly inefficient. But I can't figure out any way to keep one set of dated subfolders at the root level. Thoughts?

Issue #2: Making created subfolders off limits for further searching. Right now I've been manually tagging subfolders that shouldn't be searched by Hazel with the green label. Each rule in Hazel excludes searching green labeled folders. However, when Hazel creates a new subfolder based on the date of a video file it's moving, I wish it could auto-tag that folder to eliminate from further searches. Is there a way to do that?

Issue #3 Deleting empty subfolders. I followed the directions in the subfolder section of the documentation to have a rule which deletes empty folders (and have it occur before the "run rules on subfolders" rule). But when Hazel encounters a folder which has an empty folder inside of it, it will delete that empty subfolder as expected, but leave the parent folder. I have to run it again to get it to delete these newly empty folders.

I appreciate your help and, if you could be as specific as possible, it'd save me from continuing to barrage you with questions. Thanks.

Image

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Wed Apr 25, 2018 11:53 am
by Mr_Noodle
Issue 1: There's no better way around it if you keep files at the root. You need to have a clear path in this case and your solution provides that.

Issue 2: You might want to add a condition to the rule to go into subfolders to not go into the dated ones. There's no mechanism to tag those folders automatically when created but you can try matching on the date format, assuming that the other folders don't also have a date as their name.

Issue 3: I'd need to see the specific rules and their ordering to see what is going on.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Wed Apr 25, 2018 3:36 pm
by ericwass
Great. Thanks for your help. In regards to the last rule here's my setup...

The folder to be processed. This is all a test run using small batches of files/folders in order to iron out the kinks before I process 1000's of files. Thus the "Fake Trash":
Image

All the rules in order:
Image

The first rule to exclude folders tagged Green. If feel like the rule should say Color Label IS NOT green as opposed to IS but I found that produces the opposite behavior that I want from Hazel:
Image

Move Video to dated subfolder:
Image

Move images to dated subfolder. On occassion there's an errant image file in the mix. Just want to file them away too:
Image

Move AVCHDs to those same dated subfolders. Hazel doesn't recognizes AVCHD archives as movie files so had to create a separate rule:
Image

Delete Empty Folders. This is the one that isn't doing its job properly:
Image

Finally, process subfolders. Enabling a recursive search (I think):
Image

Hopefully this gives you the info you need. Please note that in the screenshot of the folder to be processed the "TEMPORARY HOLDING FOLDER" which Hazel moves all images to before moving them back to root is missing. But it's usually there. Thanks a lot for the assistance.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Thu Apr 26, 2018 11:23 am
by Mr_Noodle
Thanks for that. Your first rule doesn't really do anything since all files will naturally continue past the first rule if they don't match. You should do "Tag is not green, Ignore".

Also, try going through the troubleshooting guide here: https://www.noodlesoft.com/kb/hazel-tro ... ing-guide/

The preview and rule status features should provide more details as to why it isn't running/matching.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Thu May 03, 2018 2:21 pm
by ericwass
Most everything is working well now except the trashing of empty folders. I did more searching before coming back to you and it seems that there's no simple way to do what I want to do - that once Hazel processes a folder (let's say by deleting an empty subfolder) it will not go back to that folder, notice that it's now empty too and trash it until you do another pass. What this has resulted in is need three or more runs of the rule before a root folder (assuming it has subfolders and sub-files) will be deleted.

My ideal situation would be for Hazel to dive into a subfolder, find a QuickTime file, move it, recognize that the subfolder is now empty, trash it, recognize that its parent folder is now empty and trash it too. Am I right that there's no way to do this in one pass?

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Fri May 04, 2018 11:22 am
by Mr_Noodle
Why is it so important to do everything in one pass? Internally, Hazel may need to do multiple passes for various reasons but I'm not clear why that should matter as long as the files are processed.

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Fri May 04, 2018 3:24 pm
by ericwass
It's not critically important but since there are 100's and 100's of folders I'm running Hazel manually on smaller batches and it would help to have them cleared out once they're emptied so I know what's been processed and what hasn't. And right now that process involves running Hazel four or five times. If I set Hazel back on auto, will it rescan those now empty folders even though it's already processed them once?

Re: Sorting QuickTime files into subfolders by year and mont

PostPosted: Mon May 07, 2018 11:02 am
by Mr_Noodle
Are you running rules manually? You shouldn't need to do that. If you let it run automatically, it should do the right thing. The number of passes shouldn't matter then.