Can Hazel work on multiple files at once?

If I want Hazel (version 6) to zip four files (file.numbers, file.xls, file.csv, and file.pdf) into one archive, once they are all saved in a watched folder (containing other files), I have to write a script?

There’s probably no built-in condition for multiple files nor a built-in action for multiple files?

1 Like

I did a Google search on “hazel compress multiple files” and the top “AI” hit gave a suggestion which, while I did not test for you, seems worth a try.

I don’t use Google directly (but via SearXNG instead) and (therefore?) get different results. I tried via google.com as well, but still don’t get such a result.

If you are able to reproduce it, can you please share the URL?

(Or are AI answers not linkable? Never seen/tried those)

Copy/paste below. Did not test. If this not working, the Hazel forum has always answered my Hazel questions in the past.

=========

To compress multiple files using Hazel on a Mac, you can set up a rule within the application that automatically detects when a set of files appear in a specified folder, then triggers an action to compress them into a zip file, essentially allowing you to automate the process of compressing multiple files whenever they meet your defined criteria.

Key points about using Hazel to compress multiple files:

  • Create a rule:

Within Hazel, you’ll need to create a rule that defines the folder to monitor and the conditions that should trigger compression (like file type, size, or date modified).

  • Specify the action:

Set the action within the rule to “Create Zip Archive” and choose the desired output folder where the compressed file will be saved.

  • Advanced options:

You can customize further by setting options like including subfolders, adding a custom zip filename, and choosing compression level.

Example scenario:

  • Monitor folder: “Downloads” folder
  • Condition: Any file added to the folder that is a PDF document
  • Action: Create a zip archive named “PDFs_Archive” and save it in a designated “Compressed Files” folder

Thank you for sharing this!

Unfortunately this is a typical AI answer; it mentions an option that does not exist (“Create Zip Archive”; should probably be “Archive” instead?) and it does not fulfill the required task, since the suggested rule zips each file individually (as I expected); not all files in one archive.

I don’t have an account yet at the Hazel forum, but since I’m starting to seriously use Hazel, I might indeed create one after all and ask my question there. Suggestions are still welcome here though!

1 Like

Yea … it “looked” good hence I suggested it, but I’ve seen same with most AI. Hazel forum your best bet. The developer monitors. They also have a good FAQ.

1 Like

I’d run the same script on any file appearing in this folder. The script would check if all four exist and zip them in a new location if so.

1 Like

That script is exactly what I had in mind in my first post (but haven’t tried yet; maybe later today), but I do wonder whether there is no “native” way (without scripts) to do this.

Here’s the best I could come up with. I’m watching my folder. When it has a subfolder with four files inside, it zips the subfolder.

2 Likes

Thanks!

That’s the best “native” solution I could think of as well.

I think I like this solution more than a script, but I might try both.

1 Like