Page 1 of 1
How to apply a rule to only new files in a directory?

Posted:
Sun Jun 04, 2023 8:59 pm
by ss62
I am trying to create an automated workflow where every new file in my Downloads directory gets moved into a directory for the current day. This way, I can easily see all of the files downloaded on a particular day just by going to that day's directory. I created a Hazel rule which matches any file and then uses the "Sort into subfolder" action with the current date pattern. However when I tested it out just now it seems like it moved my entire existing Downloads files into a new directory for today. I guess it makes sense this would happen since my filter was "Any File", but is there a way to force Hazel to ignore already-existing files in the directory and only run my rule on *new* files that are added to Downloads?
Re: How to apply a rule to only new files in a directory?

Posted:
Mon Jun 05, 2023 8:37 am
by Mr_Noodle
Using current date may not be the best thing to use. How about using Date added instead?
Re: How to apply a rule to only new files in a directory?

Posted:
Mon Jun 05, 2023 10:36 am
by ss62
Hi Mr_Noodle - thanks so much for the suggestion. I just tried that and realized that the "Date Added" got reset to the current date for all my files in Downloads/ when I moved them back to the top-level Downloads/. It also seems like that still applied it to all of my existing files in my Downloads/ folder - I am still wondering if there's a setting to have it only apply to newly Downloaded files and ignore whatever files are currently in Downloads?
Re: How to apply a rule to only new files in a directory?

Posted:
Tue Jun 06, 2023 9:19 am
by Mr_Noodle
Something like "Date added is after date last matched" should only match the first time Hazel encounters the file. But you can't really do much about the date added being reset if you add the file to the folder again.
Re: How to apply a rule to only new files in a directory?

Posted:
Thu Jul 06, 2023 11:00 pm
by MrSeagull
ss62 wrote:I am trying to create an automated workflow where every new file in my Downloads directory gets moved into a directory for the current day. This way, I can easily see all of the files downloaded on a particular day just by going to that day's directory. I created a Hazel rule which matches any file and then uses the "Sort into subfolder" action with the current date pattern. However when I tested it out just now it seems like it moved my entire existing Downloads files into a new directory for today. I guess it makes sense this would happen since my filter was "Any File", but is there a way to force Hazel to ignore already-existing files in the directory and only run my rule on *new* files that are added to Downloads?
Could you apply it to any file except for folders? (Since folders will have been created for each day and filled with each day's files?)
Re: How to apply a rule to only new files in a directory?

Posted:
Fri Jul 07, 2023 9:21 am
by Mr_Noodle
You can always add a condition to match (or not match) folders.