Page 1 of 1

Move image files to sub-folders based on a part of filename

PostPosted: Mon Oct 07, 2019 1:28 am
by rollbahn
Hi,
I have searched everywhere and tried a few ways but I can;t seem to figure this one out.

I have a thousands of scanned image files in the following name format "00642_04_newscan.jpg". So for each roll of film there are 36 image files (sometimes more, sometimes less) and they all go into one folder at the moment before being sucked into Capture One for processing.

I want to be able to get Hazel to watch the folder that contains all the image files and then move all images that match this pattern "00xxx_xx_newscan.jpg" and create a folder called "xxx" and then move the files inside that folder.

In the above example the folder would be named "642" which is film roll 642 and then inside that would be 00642_01_newscan.jpg, 00642_02_newscan.jpg, 00642_03_newscan.jpg, 00642_04_newscan.jpg etc.

Thanks for any help you can offer.

Re: Move image files to sub-folders based on a part of filen

PostPosted: Mon Oct 07, 2019 11:16 am
by Mr_Noodle
Look up "match patterns" in the help. You can set up a pattern that mirrors what you posted. Set up a custom attribute for the XXX number and you can then use that in subsequent actions.

Re: Move image files to sub-folders based on a part of filen

PostPosted: Mon Oct 07, 2019 5:57 pm
by rollbahn
Mr_Noodle wrote:Look up "match patterns" in the help. You can set up a pattern that mirrors what you posted. Set up a custom attribute for the XXX number and you can then use that in subsequent actions.


Thanks - I have no issues with the match pattern part to find the files but I can't figure out how to loop around and put just the image files that match a certain roll number inside the matching folder. So after I reach 00642_36_newscan.jpg (the final shot on that roll of film) the next file is 00643_01_newscan.jpg and that needs to create a new folder "643" and only put in the files that match 643 and so on.

I will keep trying and see what I can sort out I guess.

Re: Move image files to sub-folders based on a part of filen

PostPosted: Tue Oct 08, 2019 2:02 am
by rollbahn
Once I found the "Custom Text" option where I could hold the number of the roll in a "variable" then everything fell into place and was stupidly easy to do. :D

If anyone is looking to do something like this:

* "Name" matches whatever files you want to find to sort - enter your pattern of the file you want and use "Custom Text" for the part of the filename you want to grab and use as the folder name later
* Then do the following to the matched files/folders - "Sort Into Subfolders" with pattern and use the Custom Text name from above and you're done!