Rename using first 5 characters of filename

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

Moderator: Mr_Noodle

Rename using first 5 characters of filename 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
bifjamod
 
Posts: 5
Joined: Mon Aug 18, 2014 5:18 pm

Have you read the help on "match patterns"?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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.)
bifjamod
 
Posts: 5
Joined: Mon Aug 18, 2014 5:18 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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.
bifjamod
 
Posts: 5
Joined: Mon Aug 18, 2014 5:18 pm


Return to Support