How To Trim Filenames

OK, I realize this is a tough ask, but here goes....

Is there a way to trim/convert/cleanup filenames that have been downloaded? Here's the scenario:

Let's say someone (not mentioning any names) cannot afford both an internet connection and cable tv. So, that someone (may or may not) download their favorite TV show episodes to watch on their computer.

Once downloaded, perhaps they would like to do a search online for cast and crew information. That is made much, much easier if the downloaded filename is in the correct form, i.e. contains no periods, and only has the proper name for the show.

Now, this un-named individual knows how to remove the periods and replace them with spaces, but does not know how to get the title correct.

Example: Here is the name of a TV show that (may or may not) have been downloaded.


Is there a way to clean all that up so that it is simply "The Totes" ?

I know this is a tough question, because the show names will differ, of course, and there won't always be the same word count.. so is this even possible, and if it is, how would one go about it? TIA!

Here is the code i use to clean up:

Rename REGEXP PATTERN="(.)(_|.| )(.)(.)(.*)#" TO="\1 \3\4\5"

You also can checkout this script. There may be other renaming scripts in that subforum, too.

Firstly, thanks for the reply!!

I made a button with the code you use, and this is the result:

T e.Totes.Freely.Distributable.Linux.ISO.Show.S02E16.720p.HDTV.x264-LINUS

So, for some reason, it didn't really work on my system. Strange..

So now I'll go check out that thread you pointed me to, and after I test it, I'll report back.

Please use example filenames that at least pretend you aren't asking people to help and publicly become party to doing something illegal.



1 Like

Why, Leo, whatever do you mean? :innocent:

An update to the situation:

I tried each and every button and script in that thread you pointed me to, without joy. It just doesn't seem possible to do what the original post was looking for.

But I do want to thank you for being the only one who gave me some suggestions. I'd like you to know that it was not my intent to have you "publicly become party to doing something illegal."

In fact, I was totally unaware, at the time, that renaming a filename was something illegal.

But live and learn, as they say. I would also say that this thread is probably pretty much dead now. Onward and forward........

Just be a bit patient, i'm sure, there will be a proper solution to your request quite soon. My first code may not include enough characters, which have to be removed, so that's why it didn't work for you, i suppose.

Myself, i have no clues about Regex, & some user from this forum here had provided that code a long time ago. But with a bit of alteration it should be a piece of cake, finally.

As for the other thing, well, the example suggested, that it maybe could be a file from Bittorrent or the like, so it is principally always better to use some more unsuspicious sounding example. :wink:

1 Like

Also, Oblias2, i overlooked some important part of your request. I thought, you only want to clean up the file names.

1 Like

No problems, and thanks again!! :grinning: