File Tagging / Moving

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

Moderator: Mr_Noodle

File Tagging / Moving Fri Aug 16, 2019 3:17 pm • by Shah
Hi. New Hazel user here, and the program is amazing - thank you!

Using Hazel, I've been able to rename Word and PDF document using content within it.
The file name now begins with a unique 9 digit number, followed by text.

The desired end result is to move each document to an existing folder whose folder names contains the unique number mentioned above.

Is that possible?

If not, I wonder if it's possible to create a tag for each file, using the partial filename (the number) and then moving them based on the tag matching the partial folder name.

Thanks!
Shah
 
Posts: 4
Joined: Fri Aug 16, 2019 2:56 pm

Re: File Tagging / Moving Mon Aug 19, 2019 9:51 am • by Mr_Noodle
Look up "match patterns" in the help. You can set up a custom attribute to match the number part. Then using "Sort into subfolder", you can sort using a partial match with the "anything" token.
Mr_Noodle
Site Admin
 
Posts: 8363
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: File Tagging / Moving Mon Aug 19, 2019 12:33 pm • by Shah
Mr_Noodle wrote:Look up "match patterns" in the help. You can set up a custom attribute to match the number part. Then using "Sort into subfolder", you can sort using a partial match with the "anything" token.


Thanks for replying!
I did set this up however it creates new subfolders with the same name as the filename, rather than moving the files to already existing folders. FYI those "existing folders" are in another folder, if that makes a difference.
Shah
 
Posts: 4
Joined: Fri Aug 16, 2019 2:56 pm

Re: File Tagging / Moving Tue Aug 20, 2019 7:24 am • by Dave61
I had a similar problem moving files to folders that might have a number+text, might only have a number, or might not exist at all. I ended up with three rules that work in sequence:
Image

The first if the folder exists with a number & text following:
Image
Notice the space between the [GameID] and […] tokens in the second "Name matches" condition. This stops folders with a number only meeting this rule. Figuring out how to distinguish between these cases was the toughest part, only accomplished with some help from the Noodle-Master himself.

The second in case it exists but has no text following:
Image

And finally, in case it does not exist at all:
Image

In all three cases "GameID" is the same match:
Image

Final points:
- the "Add comment" action you can see in all three examples, was used in debugging
- the other rules you can see have no effect on the sorting process
Last edited by Dave61 on Tue Aug 20, 2019 11:55 pm, edited 1 time in total.
Dave61
 
Posts: 103
Joined: Tue Jul 10, 2012 4:56 pm

Re: File Tagging / Moving Tue Aug 20, 2019 8:51 am • by Shah
Thank you; I shall try this soon!
The first image from Imgur you posted can't be displayed; do you mind reposting?
Shah
 
Posts: 4
Joined: Fri Aug 16, 2019 2:56 pm

Re: File Tagging / Moving Tue Aug 20, 2019 11:56 pm • by Dave61
Shah wrote:Thank you; I shall try this soon!
The first image from Imgur you posted can't be displayed; do you mind reposting?

Done
Dave61
 
Posts: 103
Joined: Tue Jul 10, 2012 4:56 pm

Re: File Tagging / Moving Sun Aug 25, 2019 11:02 pm • by Shah
Dave61 wrote:
Shah wrote:Thank you; I shall try this soon!
The first image from Imgur you posted can't be displayed; do you mind reposting?

Done


Thank you; the method seems to work! Appreciate it!
Shah
 
Posts: 4
Joined: Fri Aug 16, 2019 2:56 pm


Return to Support