Page 1 of 1

Create a new folder and move files there on a specific day

PostPosted: Sat Jul 01, 2023 12:44 pm
by IvanPsy
Greetings,
I have a Present Bills folder where I store some files along the year.
This Present Bills folder lies on a more generic Bills folder, where I store all of my bills in subfolder, each subfolder is a year (2020, 2021, ...).

My goal for this rule is:
1) at the end of the year, a new folder is created under the Bills folder. Name of the folder: the present year
2) all the files under the Present Bills folder are moved into the new folder

A real scenario:
1) at the end of this year, the "2023" folder is created under the Bills folder
2) all the files under the Present Bills folder are moved to the 2023 folder

I'd like to automate all of this for the future years.

Is it possible with Hazel? How?
I may even split into 2 rules: create the new folder on 30th December with one rule, and move the files on 31th December with another rule.
I've tried, but can't see kind of "Create new folder" option.

Re: Create a new folder and move files there on a specific d

PostPosted: Mon Jul 03, 2023 8:33 am
by Mr_Noodle
Match each of the files you want to move and use Sort into subfolder. That will create the folder as necessary.

Re: Create a new folder and move files there on a specific d

PostPosted: Tue Jul 04, 2023 8:35 am
by IvanPsy
Mr_Noodle wrote:Match each of the files you want to move and use Sort into subfolder. That will create the folder as necessary.


I'm sorry I don't understand how to use the Sort option.

How do I tell Hazel to move the files into a folder that doesn't exist yet?
If I check under the "Move" action, Hazel lets me choose only from already existing folders.

Can you please give me a feedback ab out the rule I post here as screenshots?

https://imgur.com/a/m0nqiHY

Another question: where do I put the rule?
Inside the Bills folder (that is the parent folder), or inside the Present Bills folder?

Re: Create a new folder and move files there on a specific d

PostPosted: Tue Jul 04, 2023 9:36 am
by Mr_Noodle
Sort into subfolder creates the folder if it doesn't exist. The rule should be for the folder where the files you want to process reside. If you want the subfolders to be under a different folder, then you need to do a move to that folder, then sort.

Re: Create a new folder and move files there on a specific d

PostPosted: Tue Jul 04, 2023 11:46 am
by IvanPsy
Mr_Noodle wrote:Sort into subfolder creates the folder if it doesn't exist. The rule should be for the folder where the files you want to process reside. If you want the subfolders to be under a different folder, then you need to do a move to that folder, then sort.


Can you please check the screenshot?

https://imgur.com/a/4G7kV9G

Conditions:
    At 10pm of 31st December
    Any File into the folder

Actions:
    Set into subfolder with the current date (only the year)

How do I add the Move action?
If I add the action NOW, it asks me to choose a folder that already exists.

Re: Create a new folder and move files there on a specific d

PostPosted: Wed Jul 05, 2023 8:20 am
by Mr_Noodle
Your subfolders all exist under a common folder, right? Set the move to move it to that folder.

Re: Create a new folder and move files there on a specific d

PostPosted: Thu Jul 06, 2023 6:40 am
by IvanPsy
Mr_Noodle wrote:Your subfolders all exist under a common folder, right? Set the move to move it to that folder.


Maybe a screenshot makes things clearer: it's difficult to explain by words.

This is the situation: https://imgur.com/a/Hatv1Qe . I'm sorry it's in Italian, not English.

The bills of this year are under "@Acquisti attuali".
My goal for the rule:
- On 31st December, the rule create a new folder "2023"
- Then all the files under @Acquisti attuali are moved to 2023

So the 2023 folder doesn't exist yet, as it will be created at the end of the year.
I may create the 2023 folder by hand before the end of the year, but I'd like to have a dynamic rule that work for all the years I the future automatically.

I may also create two rules:
- one that creates the 2023 folder
- one that move the files inside @Acquisti attuali to 2023

But again: now that I'm creating the rule, the 2023 folder doesn't exist yet, so: how do I tell Hazel to move the files to that folder?

Hope it makes sense.

Re: Create a new folder and move files there on a specific d

PostPosted: Thu Jul 06, 2023 8:32 am
by Mr_Noodle
You do not need a separate "create folder" step. As I mentioned, Sort into subfolder will create it as necessary.

The steps you need to do (in a single rule):
- Move to the @Acquisti folder (I assume this is the folder shown in your screenshot that contains all the other folders
- Sort into subfolder based on the year. Make sure the date format only includes the year part.

Re: Create a new folder and move files there on a specific d

PostPosted: Fri Jul 07, 2023 12:35 pm
by IvanPsy
Mr_Noodle wrote:You do not need a separate "create folder" step. As I mentioned, Sort into subfolder will create it as necessary.

The steps you need to do (in a single rule):
- Move to the @Acquisti folder (I assume this is the folder shown in your screenshot that contains all the other folders
- Sort into subfolder based on the year. Make sure the date format only includes the year part.


Can you please check that I'm doing it right?
https://imgur.com/kODARGf

Sidenote: I'd like some tutorials to learn such advanced use of Hazel, as I see I'm using it only at 10% of its potential.

Re: Create a new folder and move files there on a specific d

PostPosted: Mon Jul 10, 2023 9:11 am
by Mr_Noodle
Seems ok to me though I can't see how you formatted the "current date" attribute. How does it actually run?

Re: Create a new folder and move files there on a specific d

PostPosted: Mon Jul 10, 2023 11:10 am
by IvanPsy
Mr_Noodle wrote:Seems ok to me though I can't see how you formatted the "current date" attribute. How does it actually run?


It's set as Year: https://imgur.com/vMfsSdW

Re: Create a new folder and move files there on a specific d

PostPosted: Tue Jul 11, 2023 8:35 am
by Mr_Noodle
It looks fine. Have you actually run it?

Re: Create a new folder and move files there on a specific d

PostPosted: Tue Jul 11, 2023 2:28 pm
by IvanPsy
Mr_Noodle wrote:It looks fine. Have you actually run it?


Indeed it works.
Thank you for your support.
I've tested the rule on a Temp folder with just one file, and it worked.
Now I wait for December 31st for the main show to happen ;-)