#1 2025-02-11 17:00

handshake
Member
Registered: 2025-02-11
Posts: 3

Remove everything after a pipe "|" character

Please help me, i have been trying to find some answer regarding how I can batch rename files. The sample files I have are all like:

The Shanghai Dynasty | Chinese | Drama.mp4
The Journey | Chinese Drama | Collection.mp4
The Mystery | Action | Collection.mp4

I want to keep the title and I want to delete all the character(s) that starts with |.

output should be like:

The shanghai.mp4
The Journey.mp4

I hope someone can help. I am new to computers sad I have read the manual but my brain is not really understanding it.

Thank you so much!!

Last edited by handshake (2025-02-11 17:09)

Offline

#2 2025-02-12 01:48

eR@SeR
Senior Member
From: Земун, Србија
Registered: 2008-01-23
Posts: 356

Re: Remove everything after a pipe "|" character

Hello,

Add Regular Expressions rule:

1) Regular Expressions: Replace expression "\s?\|.+" with "" (skip extension) --- > (Replace field leave empty)

From:

The Shanghai Dynasty | Chinese | Drama.mp4
The Journey | Chinese Drama | Collection.mp4
The Mystery | Action | Collection.mp4

To:

The Shanghai Dynasty.mp4
The Journey.mp4
The Mystery.mp4

P.S. Useful course by Kevin Skoglund at LinkedIn Learning for those who would like to learn more about RegEx.


TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!

Offline

#3 2025-02-12 04:44

handshake
Member
Registered: 2025-02-11
Posts: 3

Re: Remove everything after a pipe "|" character

It is not working still.. did i do something wrong?

ReNamer RegEx Rule

ReNamer RegEx Rule

Last edited by handshake (2025-02-12 04:46)

Offline

#4 2025-02-12 05:22

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,464

Re: Remove everything after a pipe "|" character

handshake wrote:

It is not working still.. did i do something wrong?

Maybe you are trying to replace a wrong vertical line character?

Unicode has dozens of similarly looking characters, see https://www.amp-what.com/unicode/search/vertical

You need to copy the exact character that appears in your filename and use it in the regular expression provided, instead of the standard pipe character "|".

Alternatively, you could replace all variations of the vertical line character with a standard pipe character "|" using a separate Replace rule.

Offline

#5 2025-02-12 21:59

handshake
Member
Registered: 2025-02-11
Posts: 3

Re: Remove everything after a pipe "|" character

Thank you so much to both of you! Indeed the unicode character is different to what i am typing. I have been trying it for sometime now. I have been reading your guides, following all the possible formatting and it never worked. I never thought it is a different type of character. I have learned a new lesson today.

Appreciate your help!

Last edited by handshake (2025-02-12 22:00)

Offline

Board footer

Powered by FluxBB