I have files for software receipts exported as PDF from emails with the format: string-product
where strings / types are:
rsg - receipt software general (product purchase receipt)
lsg - licence software general (license details)
psg - payment software general (payment details, usually paypal)
I have equivalent triads for audio software, photographic software etc, all with three letter prefixes.
I can obviously create single rules in Hazel for every use case but I am wondering if I can handle all these with a single rule (that I can easily recreate on other computers).
What I want to do is strip the prefix, append the date from the file, move the file to an appropriate directory, and append a verbose description of the type of file.
For example,
rsg-hazel.pdf becomes ~/receipts/software/general/2015-11-12-hazel-receipt.pdf
lsg-hazel.pdf becomes ~/receipts/software/general/2015-11-12-hazel-licence.pdf
psg-hazel.pdf becomes ~/receipts/software/general/2015-11-12-hazel-payment.pdf
but
rsa-protools.pdf becomes ~/receipts/software/audio/2015-11-12-protools-receipt.pdf
As stated I have no trouble setting up a single rule for each case, but what I cannot figure out how to do is a general conditional rule that needs to:
(a) check the 3 letter prefix, and move the file to the appropriate folder
(b) strip the prefix off the front of the filename, and automatically change it to the corresponding suffix
Is there a way to do this in Hazel?
Or is it a case for a shell script?
Cheers
Nik