Page 1 of 1

Gather and archive files

PostPosted: Sat Mar 06, 2021 2:57 pm
by redsei
I'm looking for some help on gathering similar named files, containing them in a named folder and then compressed.

So to start I have 4 files.

xxxx.jpg
xxxx_small.jpg
xxxx_medium.jpg
xxxx_large.jpg
oooo.jpg

I would like all of these similar named items "xxxx" to be grouped together in a folder named "xxxx" and archived.
The only difference with the other 3 files is they have a suffix at the end. That's the only thing that distinguishes them from other files. the file "oooo.jpg" would not be included in the folder as the name is different.

Is this possible?

Re: Gather and archive files

PostPosted: Mon Mar 08, 2021 11:36 am
by Mr_Noodle
You could create a rule to use a match pattern for the xxxx part and have it sort into a subfolder based on that. You can then have another rule look for those folders and archive them.

Re: Gather and archive files

PostPosted: Mon Mar 08, 2021 2:48 pm
by redsei
Mr_Noodle wrote:You could create a rule to use a match pattern for the xxxx part and have it sort into a subfolder based on that. You can then have another rule look for those folders and archive them.



I think a problem maybe that I have thousands of these with all different names. Hazel doesn't use variables? Where it would look for "xxxx" gather and group into folder, then look at the next one "HHHH" and do the same. This would continue on throughout the folder?

Just hoping here.

Re: Gather and archive files

PostPosted: Tue Mar 09, 2021 11:12 am
by Mr_Noodle
Yes, it has variables for sorts. Look up match patterns in the help.

Re: Gather and archive files

PostPosted: Wed Mar 10, 2021 11:11 pm
by redsei
I had sent you a private message-not sure if you had time to review it.

Re: Gather and archive files

PostPosted: Thu Mar 11, 2021 9:55 am
by Mr_Noodle
PM's aren't a good way of asking questions for various reasons. Please post articles or email in.

It seems like you have at least two different patterns. One is where the name ends with a underscore and a size. Let's start with that one:
Code: Select all
If (all) are met
    Kind is jpg
    If (any) are met for (the current file)
        Name matches (• prefix)_small
        Name matches (• prefix)_medium
        Name matches (• prefix)_large
Do
    Sort into subfolder (• prefix)


where (• prefix) is a custom text attribute set to match (anything).

You can then do a rule, which must occur AFTER the above rule:
Code: Select all
If (all) are met
    Kind is jpg
    Name matches (• prefix)
Do
    Sort into subfolder (• prefix)

I suggest studying the above so you can gain an understanding of what is going on and post back here if you have questions about it.

Re: Gather and archive files

PostPosted: Sat Mar 13, 2021 9:09 pm
by redsei
Ok... I must be like a squeaky wheel now. I'm not explaining myself right I feel.

I will give another example

My potential file names are

rabbit1.jpg
rabbit1_small.jpg
rabbit1_medium.jpg
rabbit1_large.jpg
rabbit2.jpg
rabbit2_small.jpg
rabbit2_medium.jpg
rabbit2_large.jpg
dog12.jpg
dog12_small.jpg
dog12_medium.jpg
dog12_large.jpg

I would like hazel to look through all of these files at once, sort all of the rabbit1 files, rabbit2 files and dog12 files and place each of them in a separate folder

the results would be

rabbit1 (folder)
    rabbit1.jpg
    rabbit1_small.jpg
    rabbit1_medium.jpg
    rabbit1_large.jpg

rabbit2 (folder)
    rabbit2.jpg
    rabbit2_small.jpg
    rabbit2_medium.jpg
    rabbit2_large.jpg

dog12 (folder)
    dog12.jpg
    dog12_small.jpg
    dog12_medium.jpg
    dog12_large.jpg

Does this make better sense? :)

Re: Gather and archive files

PostPosted: Mon Mar 15, 2021 9:12 am
by Mr_Noodle
Yes, and my previous post still stands.

Re: Gather and archive files

PostPosted: Mon Mar 15, 2021 9:54 am
by redsei
Mr_Noodle wrote:Yes, and my previous post still stands.



OK, I'll have another go at it.....

Thanks

Re: Gather and archive files

PostPosted: Mon Mar 15, 2021 8:24 pm
by redsei
redsei wrote:
Mr_Noodle wrote:Yes, and my previous post still stands.



OK, I'll have another go at it.....

Thanks


I gotta say thank you for being patient. I kind of gave my brain a shake and redid what you said. It works!! This has saved me literally hundreds of hours. I had over 40,000+ files to do. All done in 3 min. :shock: :D 8)