Create a Folder Structure.

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Create a Folder Structure. Sun May 17, 2020 1:01 am • by optimus1509
Hi,

I am trying to see if this is achievable by Hazel and any help is appreciated. I have a lot of pictures i would like to order in the following way -

Folder-->File added-->move to folder with name <DD-MMM-YYYY> from modification date of file.
if Folder-->DD-MMM-YY exists move to folder <MMM-YYY>
if Folder-->MMM-YY exists move to folder <YYYY>

If a new file is added on the same date, the file should go back to original DD-MMM-YYYY folder created above and not create duplicate folders with the same date.

In Summary, i want to file images in the format:

YYYY-->MMM-YYY-->DD-MMM-YYY

DD-MMM-YYY will contain multiple images.
MMM-YYY will contain multiple folders for different dates.
YYYY will contain multiple folders for different months.
Folder will contain multiple folders for different years.
optimus1509
 
Posts: 7
Joined: Thu May 05, 2016 1:47 pm

Re: Create a Folder Structure. Mon May 18, 2020 10:32 am • by Mr_Noodle
That should be doable using Sort into subfolder. You can use the right pointing triangle to separate folder levels and edit the date format to include/exclude the parts of the date as needed.
Mr_Noodle
Site Admin
 
Posts: 9017
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create a Folder Structure. Mon May 18, 2020 12:18 pm • by optimus1509
The right triangle did the trick. Thank you.
optimus1509
 
Posts: 7
Joined: Thu May 05, 2016 1:47 pm

Re: Create a Folder Structure. Mon May 18, 2020 4:01 pm • by optimus1509
Hi, I had one more question on this:

If the folder at the lowest level becomes empty (because i deleted an image i don't need) how do i ask hazel to delete empty folders at any level?

Using the empty folders rule -

Kind is Folder
Sub-file/folder count is 0
Move to Trash

above deletes only empty folders at the top most level.

If i have go into subfolders rule enabled, then my folder structure gets created recursively creating a huge mess. I want to be able to keep the folder structure above but delete any empty sub-folders at any level. Any tips please?

So in essence, if DD-MMM-YYYY becomes empty, delete it.
if MMM-YYYY becomes empty delete it,
if YYYY becomes empty then delete it.
optimus1509
 
Posts: 7
Joined: Thu May 05, 2016 1:47 pm

Re: Create a Folder Structure. Tue May 19, 2020 9:57 am • by Mr_Noodle
It should work. You just need to add a condition to the rule that does Sort into subfolder to only operate at subfolder level 0.
Mr_Noodle
Site Admin
 
Posts: 9017
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create a Folder Structure. Wed May 20, 2020 10:56 pm • by optimus1509
Mr_Noodle wrote:It should work. You just need to add a condition to the rule that does Sort into subfolder to only operate at subfolder level 0.


Please elaborate a little. There is rule that is creating the folder structure and another rule that is deleting empty folders. Which rule should be update to operate at subfolder level 0?

The delete empty folder rule i have is as follows -

kind is folder
sub-file/folder count is 0
move to folder trash.

I want to modify the above to delete empty sub folders at any sub folder level. Thank you for all your help.:)
optimus1509
 
Posts: 7
Joined: Thu May 05, 2016 1:47 pm

Re: Create a Folder Structure. Thu May 21, 2020 10:30 am • by Mr_Noodle
Your delete empty folders only works at the top level as you have the Subfolder level is 0 condition there. You need to move that to the other rule, which you do actually want to limit to the top level.
Mr_Noodle
Site Admin
 
Posts: 9017
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create a Folder Structure. Thu May 21, 2020 12:35 pm • by optimus1509
Mr_Noodle wrote:Your delete empty folders only works at the top level as you have the Subfolder level is 0 condition there. You need to move that to the other rule, which you do actually want to limit to the top level.


Sorry for my inexperience, but it did not work for me. If i move sub-file/folder count is 0 to the rule that creates the folder structure rule, the rule continues to work but deleting empty folders at the nth level doesn't.

Here is how i have it setup -

Folder Structure rule
If any of these conditions are met -
sub-file/folder count is 0
if any of the following conditions are met for the current folder
extension is jpg
extension is snagproj
date last modified is not today
sort in subfolder with pattern date modified(YYYY)>date modified(MMMM-YYYY)>date modified(DD-MMMM-YYYY)

Delete empty folders rule -
kind is folder
sub-file/folder count is 0
move to folder trash.

Just so we are aligned, i only want delete specific folders that are empty at any level in the above structure and not the entire structure as there may be other non-empty folders at the same level. Any chance you can modify the above rules for me? Thank you for all your help.
optimus1509
 
Posts: 7
Joined: Thu May 05, 2016 1:47 pm

Re: Create a Folder Structure. Fri May 22, 2020 10:11 am • by Mr_Noodle
You need to change the first "any" to "all".
Mr_Noodle
Site Admin
 
Posts: 9017
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion