Move files to the most recently created folder

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I have two items that I would like moved to the same folder when downloaded. The first rule (operating successfully) triggers based on attributes of the first file (contents contain, contains match) and processes the file by renaming it based on the found attributes and then moves it into a subfolder created by its attributes. I would like the second file to be moved and renamed to the same folder. However, the folder that both files need to be moved to changes based on the first files attributes. Thus, I need a "move to folder" option that allows me to specify something like "last changed folder" so that I can move it to the correct folder and rename it based on that folder name. Is there such an option? If not, is there a way that I can combine these two things into a single action where the name and folder would be in the same Hazel rule?

Example of Problem:

File A
File B

File A is searched, renamed, and moved to a subfolder based on its attributes
File B is downloaded and triggered based on its attributes and needs to be moved to the same folder as File A (but this folder is different and depends on the attributes of File A)

See original rule for File A at this link (this rule does not incorporate File B but needs to):

https://www.dropbox.com/s/oq03jayall6g7 ... M.png?dl=0

Any guidance on this problem is greatly appreciated. This is my first post to this group.

Brad
Dr.Tech
 
Posts: 4
Joined: Tue Nov 12, 2019 2:28 pm

What's the relationship between the two files? How would Hazel know it's File B and not some other file which got dropped in there at the same time?
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

To be transparent, I am editor for an academic journal and one file is the manuscript file that has a manuscript ID in the pdf. Hazel uses this information to rename the file, create a folder, and move the manuscript to the newly created folder. Then, I will download the letter to the editor, which does not contain the information of the manuscript. Hazel will recognize this file based on the pdf creation tool on our editing web site. However, once the rule triggers, I am unsure how to get Hazel to rename and move the file to the newly created folder in step one (since the letter to the editor does not contain the information in the manuscript file). Please let me know if I can answer more questions to be more clear. Thank you for your help.
Dr.Tech
 
Posts: 4
Joined: Tue Nov 12, 2019 2:28 pm

You might be able to use nested conditions here. Look them up in the manual. You can use the "any file in the same folder" and use the same conditions as the other rule. You are basically saying, match this file is these conditions match for another file.

Now, the tricky part is that file B has to be matched first before A, since, if A is moved, it's no longer there for file B. You can try adding a condition on the rule to match file A to indicate that it's the only file in the folder (if that is indeed the case). You can use a nested condition to match against the enclosing folder and check its sub-item count.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

These are great suggestions. I will try them and report back. Many thanks!
Dr.Tech
 
Posts: 4
Joined: Tue Nov 12, 2019 2:28 pm

I have attempted to use the steps you outline above. They move both files but, File B fails to move with the error "Could not move file name because source and destination are the same." Does anyone have any other thoughts. I have noted a link to a screenshot of the current rule below. Thanks in advance.

https://www.dropbox.com/s/a0xlx2vnpep2o ... M.png?dl=0
Dr.Tech
 
Posts: 4
Joined: Tue Nov 12, 2019 2:28 pm

Try using the preview function and see what value Manuscript ID has for that file.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support