INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Renaming Files  (Read 574 times)

nathanchavez

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 292
  • I know nothing except for the fact of my ignorance
Renaming Files
« on: March 11, 2024, 01:35:56 pm »

Is it possible to replace the first X number of characters from a filename?  I can't see how to do that.  I can use find and replace, using the name category, but I'm not sure if I can use variables there.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Renaming Files
« Reply #1 on: March 11, 2024, 02:33:51 pm »

Sure. You can use the F6 tool or an expression on the [Filename] tag. Can you give an example of a before/after filename?
Also, you want to change the [Name] field or the actual filename on disk?
Logged

nathanchavez

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 292
  • I know nothing except for the fact of my ignorance
Re: Renaming Files
« Reply #2 on: March 11, 2024, 03:01:22 pm »

I found the entire red green show at archive.org.  It's 300 episodes.  But the file names are not done by season, like the reason of my library; for example, S15E13 - 294 The Big Retreat as opposed to S15E13 - The Big Retreat.  The total episode count was added, and I'm trying to rename them without that.  So, I need to erase the three numbered characters from the name field and then use f6 to rename the file.  The file currently on the disk in named using the the total episode count.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Renaming Files
« Reply #3 on: March 11, 2024, 03:12:50 pm »

If that pattern is valid for all files, this should work:
Code: [Select]
=regex([Name],/#(.+?)\s*-\s*\d+\s*(.+)#/,-1)[R1] - [R2]
You could instead use the "Fill Properties From Filename" tool to fill in the [Season], [Episode] and [Name] fields, then use that info to rename the files. This way you could do a Get Movie&TV Info too.

On the F12 tool, use a rule like:
S[Season]E[Episode] - [] [Name]
Logged

nathanchavez

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 292
  • I know nothing except for the fact of my ignorance
Re: Renaming Files
« Reply #4 on: March 11, 2024, 03:33:20 pm »

That doesn't work.    Using: "=regex([Name],/#(.+?)\s*-\s*\d+\s*(.+)#/,-1)[R1] - [R2]" results in all names now becoming "-".
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Renaming Files
« Reply #5 on: March 11, 2024, 03:37:12 pm »

Then your [Name] field is not in the "S15E13 - 294 The Big Retreat" format.
You can test the expression in an Expression column to avoid changing [Name].
Logged

nathanchavez

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 292
  • I know nothing except for the fact of my ignorance
Re: Renaming Files
« Reply #6 on: March 11, 2024, 03:44:18 pm »

No.  It's slightly different; S15E13 - Ep 294 - The Big Retreat.  I need to get rid of "Ep 294 - ", for example.  I think I was off.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Renaming Files
« Reply #7 on: March 11, 2024, 04:09:42 pm »

OK, try this then:
Code: [Select]
=regex([Name],/#(.+?)-.+?-(.+)#/,-1)trim([R1]) - trim([R2])
Logged

nathanchavez

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 292
  • I know nothing except for the fact of my ignorance
Re: Renaming Files
« Reply #8 on: March 11, 2024, 04:19:31 pm »

Thanks!  That worked.
Logged
Pages: [1]   Go Up