Matching Same File in Different Folders

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

Moderator: Mr_Noodle

Matching Same File in Different Folders Sat Nov 26, 2016 5:16 pm • by arggo
HI Mr. Noodle & Others, thanks for your last help.

Looking to matching same file in different folders then moving only one to archive is my problem. How to do it?

Have so far set up a pdf OCR workflow for research documents - a mixture of thesis layout and (usually) two column journal articles.

Over five steps documents go from folder: 1.Original Source; 2.OCRtodo; 3.OCR Chamber; 4.Searchable documents; 5.Original source archive.

I need to make all document searchable for a number of academic programs. Just OCRing them all is not the answer either, but I wish it was. Those in the thesis format are straight forward enough, they go into folder "1" and get processed through to "4."

My problem then, is that after an OCR.pdf lands in folder "4.searchable documents" it has been renamed with "-ocr" and colour coded green. The "original source document" has remained in the folder: "1.Original Source" and now needs to be moved from folder "1" to "5" for archiving . I do this manually and want to automate it so i can begin batch processing all the documents i have or concentrate on extracting and converting the journal articles into the thesis format.

Is there a way i can get Hazel to look at the file in folder "4" that has just been OCRed and then search and match for that documents original in folder "1", so that the original can then be move to folder: "5.archive"?

I cannot write apple scripts and i have just progressed from Hazel to Apple Automator, (so as to run the OCR software when a pdf is dropped into folder "3.OCR Chamber.", so my learning curve is steep. Any solutions in Hazel for this?

Thanks. Sorry it that is a bit long.
arggo
 
Posts: 5
Joined: Tue Apr 08, 2014 8:30 am
Location: Adelaide, South Australia

Re: Matching Same File in Different Folders Mon Nov 28, 2016 12:44 pm • by Mr_Noodle
It might be doable if folder 1 and 4 are under a common folder. It is very tricky though.

In folder 1, you can try something like:
Code: Select all
    If (all) are met
        If (all) are met for (the enclosing folder)
            If (all) are met for (any of its subfiles)
                Name is "4.Searchable documents"
                If (all) are met for (any of its subfiles)
                    Name matches (name)-ocr


That will try and match if a file matching the same filename with -ocr at the end is in the 4.Searchable documents folder. You may need to tweak it but the basic structure is there.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Matching Same File in Different Folders Mon May 21, 2018 6:04 pm • by arggo
Mr Noodle! Thanks for your reply here and the script work. I apologies for not responding - I honestly don't know how I missed this. In fact, I did not solve the problem and only found your response along with and my own question - when it turned up in a search for the very same thing. That must be a first I'm sure. I'm sure. I could offer you all sorts of excuses here, but after two years... two years... just shocked..., I'm just so sorry that I missed this and appeared to have wasted your time.
I love Hazel and I wouldn't be without it. I run it and a couple of other programs as my central automation apps. I have slowly learnt to script as well ... since this post, more a cut n' paste of different chunks of pre-written scripts that I cobble together, but I'm getting there, but I haven't solved this. I'll give the script a try. Again, thank you so much.
arggo
 
Posts: 5
Joined: Tue Apr 08, 2014 8:30 am
Location: Adelaide, South Australia


Return to Support