Save current modification date before processing

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

Moderator: Mr_Noodle

Save current modification date before processing Wed Mar 13, 2013 12:46 pm • by mcheck
I would like to use the current modification/creation date for a file, e.g. save it in a variable, before it changed during processing.

I have an enormous list of documents that may have/not been OCR'd before scanned. I have a rule that will check for OCR, and run it through ABBY FineReader if not. ABBYY default behavior is to save the new file and delete the original. Now when Hazel processes the file, to move it into my folder structure based on content, I want to prepend the modification date, but the original date, not the new one created by ABBYY. Since may of these documents were scanned years ago, I essentially want to preserve the original mod date from the file before it gets removed.

Can you suggest a way to do this?

Thanks,

Mike
mcheck
 
Posts: 8
Joined: Wed Mar 13, 2013 10:35 am

How about pre-pending the mod date before sending it to ABBYY?
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I ended up doing exactly that. But I wanted to avoid placing in the filename (though that is where it would go eventually) because once scanning/OCR is done, it moves the file according to content and I have to parse the incoming filename date for every content rule before adding a name based on content and moving the file. I was trying to avoid having to add repetitive tests/results in every content rule.

Here is what I came up with:

The OCR folder
* parses the date in the filename (if there is one) and pre-pends to filename as YYYY-MM-DD.
* prepends creation date if no other date is present
* checks if file needs OCR, then performs it
* moves it to new folder for content processing

All rules
Image

Parse the date in filename, or respect it if already present
Image

The issue now is that for all my content rules in "20 processor" folder (30 and counting), I have to add another parsing test at the top, to check for the pre-pended date, push into a custom token, then use that date token when renaming the file. Not a big deal, mind you, just wanted to write clever rules to keep it DRY (Dont Repeat Yourself)

One way I help speed the content rule creation flow, is to add the base rules to a template, save it as a non-running rule, and modify it whenever I encounter new content in an OCR scan that I want to filter/move differently than is set up. Here's a pic of that template:

Image

If there is better, more efficient, way to arrange these content rules, and use the pre-pended date, I'd love to implement it.

Mike
mcheck
 
Posts: 8
Joined: Wed Mar 13, 2013 10:35 am


Return to Support

cron