Complex(?) File Renaming

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

Moderator: Mr_Noodle

Complex(?) File Renaming Wed May 11, 2016 5:15 am • by dyntr
Hi all,

I'm a newbie to Hazel and whilst I have mastered the absolute basics of the actions (moving/ renaming files/ adding tags/ etc), I'm really keen to exploit the power of hazel to help me out with some very laborious tasks. Note, I don't know anything about scripting!

I have inherited a large number of files that require sorting which are structured in terms of naming as follows;

Companyname.yy.mm.dd.Firstname.Surname.Title.of.Project.extension

The 'Companyname' sometimes changes, the 'Firstname'/ 'Surname' often change and the 'Title.of.Project' is almost always unique.

Question 1
How do I go about amending '.' to either '-' or '_' (I need the files to match an existing structure that I have). For Example:

Companyname_yy.mm.dd_Firstname.Surname_Title-of-Project.extension

Question 2
Is it possible to amend the 'Companyname' to an abbreviation (i.e. to replace 'Companyname' to 'cn'). As the companyname rarely changes, I suppose this could be a simple replacement of the text which I specifically define within the rule. For example:

cn_yy-mm-dd_Firstname.Surname_Title-of-Project.extension

Question 3
This (I suspect) might be the tricky one... as the 'Firstname' & 'Surname' have an almost unlimited number of configurations (due to the number of people involved), and it would take a long time to specify all of the variables in separate rules. Is it possible for both the 'Firstname' and 'Surname' to be automatically abbreviated to their initials (and lose the '.' in between). for example;

cn_yy-mm-dd_fs_Title-of-Project.extension

Basically, I would like the particular name to be interrogated, the initial retained and made lowercase, and the rest deleted.

Question 4
Lastly is it possible to make the 'Title-of-Project' entirely lowercase;

cn_yy-mm-dd_fs_title-of-project.extension

I appreciate that this is quite specific, if it's not possible I suppose could just accept that I have inherited a different naming convention for the new files, but I feel that with Hazel it should be possible to get the new file names closer to my existing archive (if not identical).

I would be grateful for any help whatsoever, I'm a massive fan of Hazel, thank you so much for the awesome work that has been put into it!
dyntr
 
Posts: 1
Joined: Wed May 11, 2016 4:42 am

Re: Complex(?) File Renaming Wed May 11, 2016 10:47 am • by Mr_Noodle
Have you checked out match patterns? If not then search the help for it. As for replacements, you can use the text replacement feature to do that part.
Mr_Noodle
Site Admin
 
Posts: 11875
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support