Page 1 of 1

Rename using first 5 characters of filename

PostPosted: Mon Aug 25, 2014 2:03 pm
by bifjamod
I would like to create a rule that "simply" renames a file based on the first five characters of the filename. The samples in question look something like
28366_HUBER_RAIL082520141300.140825010038293.html

where 28366 represents my file number, the _HUBER_RAIL represent essentially a control, and the rest of it is both the timestamp (before the .) and something unique the app generating the file is creating. My rule will be activated by the presence of _HUBER_RAIL in the name.

Now, I can have these files pretty much named whatever I want to begin with, but because the timestamp and the unique number are out of my control, I'd just as soon leave it as is.

What I need is a way to rename the file just using the first five digits. I've scanned the forum, and see some stuff that kind of addresses this, but gets into custom tokens (which I fiddled with momentarily, and really don't understand) and RegEx stuff (which is over my head at this point).

Can anyone help me understand how I can accomplish this?

Thanks

Re: Rename using first 5 characters of filename

PostPosted: Tue Aug 26, 2014 3:45 pm
by Mr_Noodle
Have you read the help on "match patterns"?

Re: Rename using first 5 characters of filename

PostPosted: Tue Aug 26, 2014 4:08 pm
by bifjamod
Mr_Noodle wrote:Have you read the help on "match patterns"?

I perused it, but didn't really understand it. It's not that I don't want to learn it, but I have only so much time and so much capability (my learning is going into AppleScript right now). I.T. is not my profession, just a tool. I'll look for another solution (I can probably accomplish this with AS anyway.)

Re: Rename using first 5 characters of filename

PostPosted: Wed Aug 27, 2014 11:53 am
by Mr_Noodle
Using match patterns is much simpler than using AS for this purpose. I suggest following the example in the help closely. Implement it yourself instead of just reading it so you can get a sense of how it really works.

Re: Rename using first 5 characters of filename

PostPosted: Sat Sep 13, 2014 5:13 pm
by bifjamod
I don't understand your matching system. I've tried fiddling around with it, and it does not work for me. As I mentioned previously, IT is not my profession, but a tool. Unfortunately, I just don't have the time to deeply learn about many of the tools I am using, and I have to prioritize what I can do and outsource the rest. In this case, I hired a script writer on Fiverr to write a shell script to accomplish this, with success.