Jump to content



Photo

I wrote a batch file renamer


  • Please log in to reply
11 replies to this topic

#1 articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 12 May 2011 - 09:07

I like many people have a ton of media on my computer (all of it legally obtained of course >.>). I find one of the most annoying things is renaming files to suit your naming schema, and I had about 150 files to rename, so I figured I would write my own application to do it :)

It's a very simple application, it replaces strings inside of names with a string of your choosing, for instance:

Posted Image


It let's you:
  • See the names of all the files in the directory.
  • See instantly how many items will be affected by the change.
  • Let's you simulate the change so as to check the result will be what you want/expect.
  • Produces full logs (including error reports if somethings fails).
  • Allows you to save the logs for whatever reason you see fit.
Log File:
Changed working directory to:
 -- E:\The West Wing\Season 1\
 
 Directory contains:
 -- The West Wing Season 1 Episode 01 - Pilot.avi
 -- The West Wing Season 1 Episode 02 - Post Hoc, Ergo Propter Hoe.avi
 -- The West Wing Season 1 Episode 03 - A Proportional Response.avi
 -- The West Wing Season 1 Episode 04 - Five Votes Down.avi
 -- The West Wing Season 1 Episode 05 - The Crackpots and These Women.avi
 -- The West Wing Season 1 Episode 06 - Mr. Willis of Ohio.avi
 -- The West Wing Season 1 Episode 07 - The State Dinner.avi
 -- The West Wing Season 1 Episode 08 - Enemies.avi
 -- The West Wing Season 1 Episode 09 - The Short List.avi
 -- The West Wing Season 1 Episode 10 - In Excelsis Deo.avi
 -- The West Wing Season 1 Episode 11 - Lord John Marbury.avi
 -- The West Wing Season 1 Episode 12 - He Shall From Time To Time....avi
 -- The West Wing Season 1 Episode 13 - Take Out The Trash Day.avi
 -- The West Wing Season 1 Episode 14 - Take This Sabbath Day.avi
 -- The West Wing Season 1 Episode 15 - Celestial Navigation.avi
 -- The West Wing Season 1 Episode 16 - 20 Hours in L.A..avi
 -- The West Wing Season 1 Episode 17 - The White House Pro-Am.avi
 -- The West Wing Season 1 Episode 18 - Six Meetings Before Lunch.avi
 -- The West Wing Season 1 Episode 19 - Let Bartlet Be Bartlet.avi
 -- The West Wing Season 1 Episode 20 - Mandatory Minimums.avi
 -- The West Wing Season 1 Episode 21 - Lies, Damn Lies and Statistics.avi
 -- The West Wing Season 1 Episode 22 - What Kind of Day Has It Been.avi
 
 Simulated renames:
 The West Wing 1x01 - Pilot.avi
 The West Wing 1x02 - Post Hoc, Ergo Propter Hoe.avi
 The West Wing 1x03 - A Proportional Response.avi
 The West Wing 1x04 - Five Votes Down.avi
 The West Wing 1x05 - The Crackpots and These Women.avi
 The West Wing 1x06 - Mr. Willis of Ohio.avi
 The West Wing 1x07 - The State Dinner.avi
 The West Wing 1x08 - Enemies.avi
 The West Wing 1x09 - The Short List.avi
 The West Wing 1x10 - In Excelsis Deo.avi
 The West Wing 1x11 - Lord John Marbury.avi
 The West Wing 1x12 - He Shall From Time To Time....avi
 The West Wing 1x13 - Take Out The Trash Day.avi
 The West Wing 1x14 - Take This Sabbath Day.avi
 The West Wing 1x15 - Celestial Navigation.avi
 The West Wing 1x16 - 20 Hours in L.A..avi
 The West Wing 1x17 - The White House Pro-Am.avi
 The West Wing 1x18 - Six Meetings Before Lunch.avi
 The West Wing 1x19 - Let Bartlet Be Bartlet.avi
 The West Wing 1x20 - Mandatory Minimums.avi
 The West Wing 1x21 - Lies, Damn Lies and Statistics.avi
 The West Wing 1x22 - What Kind of Day Has It Been.avi
 
 Renamed: The West Wing 1x01 - Pilot.avi
 Renamed: The West Wing 1x02 - Post Hoc, Ergo Propter Hoe.avi
 Renamed: The West Wing 1x03 - A Proportional Response.avi
 Renamed: The West Wing 1x04 - Five Votes Down.avi
 Renamed: The West Wing 1x05 - The Crackpots and These Women.avi
 Renamed: The West Wing 1x06 - Mr. Willis of Ohio.avi
 Renamed: The West Wing 1x07 - The State Dinner.avi
 Renamed: The West Wing 1x08 - Enemies.avi
 Renamed: The West Wing 1x09 - The Short List.avi
 Renamed: The West Wing 1x10 - In Excelsis Deo.avi
 Renamed: The West Wing 1x11 - Lord John Marbury.avi
 Renamed: The West Wing 1x12 - He Shall From Time To Time....avi
 Renamed: The West Wing 1x13 - Take Out The Trash Day.avi
 Renamed: The West Wing 1x14 - Take This Sabbath Day.avi
 Renamed: The West Wing 1x15 - Celestial Navigation.avi
 Renamed: The West Wing 1x16 - 20 Hours in L.A..avi
 Renamed: The West Wing 1x17 - The White House Pro-Am.avi
 Renamed: The West Wing 1x18 - Six Meetings Before Lunch.avi
 Renamed: The West Wing 1x19 - Let Bartlet Be Bartlet.avi
 Renamed: The West Wing 1x20 - Mandatory Minimums.avi
 Renamed: The West Wing 1x21 - Lies, Damn Lies and Statistics.avi
 Renamed: The West Wing 1x22 - What Kind of Day Has It Been.avi
 
 
 Changed working directory to:
 -- E:\The West Wing\Season 2\
 
 Directory contains:
 -- The West Wing Season 2 Episode 01 - In The Shadow of Two Gunman (Part 1).avi
 -- The West Wing Season 2 Episode 02 - In The Shadow of Two Gunmen (Part 2).avi
 -- The West Wing Season 2 Episode 03 - The Midterms.avi
 -- The West Wing Season 2 Episode 04 - In This White House.avi
 -- The West Wing Season 2 Episode 05 - And It's Surely To Their Credit.avi
 -- The West Wing Season 2 Episode 06 - The Lame Duck Congress.avi
 -- The West Wing Season 2 Episode 07 - The Portland Trip.avi
 -- The West Wing Season 2 Episode 08 - Shibboleth.avi
 -- The West Wing Season 2 Episode 09 - Galileo.avi
 -- The West Wing Season 2 Episode 10 - Noel.avi
 -- The West Wing Season 2 Episode 11 - The Leadership Breakfast.avi
 -- The West Wing Season 2 Episode 12 - The Drop-in.avi
 -- The West Wing Season 2 Episode 13 - Bartlet's Third State of the Union.avi
 -- The West Wing Season 2 Episode 14 - The War At Home.avi
 -- The West Wing Season 2 Episode 15 - Ellie.avi
 -- The West Wing Season 2 Episode 16 - Somebody's Going to Emergency, Somebody's Going to Jail.avi
 -- The West Wing Season 2 Episode 17 - The Stackhouse Filibuster.avi
 -- The West Wing Season 2 Episode 18 - 17 People.avi
 -- The West Wing Season 2 Episode 19 - Bad Moon Rising.avi
 -- The West Wing Season 2 Episode 20 - The Fall's Gonna Kill You.avi
 -- The West Wing Season 2 Episode 21 - 18th and Potomac.avi
 -- The West Wing Season 2 Episode 22 - Two Cathedrals.avi
etc etc..

It's about 4 hours work with all of the error checking and such, and there are 3 remaining visual bugs to fix, but it works in entirety :)

I'm just wondering if anyone would be interested in the application? I'm happy to fix the bugs and just post up an executable for anyone interested, just wanted to gauge interest first :)

DOWNLOAD LINK: http://filebeam.com/...2373705cc2610b9


#2 OP articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 12 May 2011 - 09:53

And I just fixed the display bugs :)

Everything works perfectly now :D

#3 JAGFin1

JAGFin1

    I like turtles.

  • Joined: 09-August 10
  • Location: Devon, UK

Posted 12 May 2011 - 09:59

For 4 hours work, that's pretty impressive. Might I ask what you wrote the UI in?

Also, how well does it handle multiple shows? Would I be able to rename varying seasons from two or more different shows at once?

This app is very similar to EpNamer, which has been online for a while now. http://www.epnamer.com/

#4 OP articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 12 May 2011 - 10:05

Hey JagFin1,

It's WPF and C#. It's using .net 3.0 which means Vista and 7 are supported out of the box, XP SP3 is supported also by default, but earlier versions need to make sure they have .net 3.0 installed

It's just renaming everything in a folder. Once you are done torrenting your legal TV shows (>.>) just move all the episodes into a folder and you can do string replacements on them..

I've never see EpNamer before, it's quite cool.

You could use my tool to compliment that app, for instance if it names the episode: "2x16 - Episode Name Here" (which appears to be default behaviour >.<) simply replace "2x" with "Show Name 2x" and it will save you renaming them all by hand.

My app will rename literally anything to boot :)

#5 omganinja

omganinja

    Neowinian

  • Joined: 02-June 07
  • Location: Brisbane, Australia

Posted 12 May 2011 - 10:08

http://tvrenamer.com/

#6 OP articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 12 May 2011 - 10:24

Well, on JAGFin1's advice, I looked at EpNamer's tool.

It's great and I'm currently running it on a bunch of folders..

It does miss some things though, for instance:
Hawaii 5-0 is shown as Hawaii 5-0 (2010) in EpNamer. This is where my application comes in handy.

The same is true of the way it shows season numbers, I don't want 06, rather 6. My app will do that for me :)

Lastly: My app works on EVERYTHING. I'm not trying to promote it as a TV show renamer either, it can do anything >.<

Anyways, I just thought it might have filled a gap for some people, as it turns out it doesn't matter :)

#7 Ian Wilcox

Ian Wilcox

    Neowinian

  • Joined: 08-May 11
  • Location: United Kingdom

Posted 12 May 2011 - 10:30

I would be intrested.... forever changing file names!!!! :sleep:

#8 JAGFin1

JAGFin1

    I like turtles.

  • Joined: 09-August 10
  • Location: Devon, UK

Posted 12 May 2011 - 10:37

articuno1au: Drop me the .exe or whatever executable you're using for your app and I'll use it. Might as well test it seeing as I have a few bits and pieces to do.

I think what sets EpNamer aside from what you're doing, however, is that after many [legal] downloads *ahem* of TV series, the ripper's tagline is often the name of the file. EpNamer grabs the real episode names from an online database. Coupling that with your app's flexibility, it would make your app a lot more usable (if it doesn't do that already).

#9 OP articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 12 May 2011 - 10:48

Indeed, that's what I had been thinking..

Here's my latest log (from fiddling with EpNamer):
Changed working directory to:
 -- C:\Users\Admin\Desktop\Torrents\
 
 Directory contains:
 -- Blue Bloods 01x18 - To Tell The Truth.avi
 -- Blue Bloods 01x19 - Model Behavior.avi
 -- Blue Bloods 01x20 - All That Glitter.avi
 -- Blue Bloods 01x21 - Cellar Boy.avi
 -- defaced-jackass.avi
 -- Hawaii Five-0 (2010) 01x19 - Ne Me'e Laua Na Paio.avi
 -- Hawaii Five-0 (2010) 01x20 - Ma Ke Kahakai.avi
 -- Hawaii Five-0 (2010) 01x21 - Ho'opa'i.avi
 -- Hawaii Five-0 (2010) 01x22 - Ho'ohuli Na'au.avi
 -- Hawaii Five-0 (2010) 01x23 - Ua Hiki Mai Kapalena Pau.avi
 -- House 07x18 - The Dig.avi
 -- House 07x19 - Last Temptation.avi
 -- House 07x20 - Changes.avi
 -- House 07x21 - The Fix.avi
 -- How I Met Your Mother 06x20 - The Exploding Meatball Sub.avi
 -- How I Met Your Mother 06x21 - Hopeless.avi
 -- How I Met Your Mother 06x22 - The Perfect Cocktail.avi
 -- How I Met Your Mother 06x23 - Landmarks.avi
 -- NCIS 08x21 - Dead Reflection.avi
 -- NCIS 08x22 - Baltimore.avi
 -- NCIS 08x23 - Swan Song.avi
 -- NCIS Los Angeles 02x21 - Rocket Man.avi
 -- NCIS Los Angeles 02x22 - Plan B.avi
 -- NCIS Los Angeles 02x23 - Imposters.avi
 -- Stargate Universe 02x16 - The Hunt.avi
 -- Stargate Universe 02x17 - Common Descent (1).avi
 -- Stargate Universe 02x18 - Epilogue (2).avi
 -- Stargate Universe 02x19 - Blockade.avi
 -- Stargate Universe 02x20 - Gauntlet.avi
 -- The Big Bang Theory 04x20 - The Herb Garden Germination.avi
 -- The Big Bang Theory 04x21 - The Agreement Dissection.avi
 -- The Big Bang Theory 04x22 - The Wildebeest Implementation.avi
 -- The Mentalist 03x19 - Every Rose Has Its Thorn.avi
 -- The Mentalist 03x20 - Redacted.avi
 -- The Mentalist 03x21 - Like a Redheaded Stepchild.avi
 
 Beginning rename pass..
 Renamed: Blue Bloods 1x18 - To Tell The Truth.avi
 Renamed: Blue Bloods 1x19 - Model Behavior.avi
 Renamed: Blue Bloods 1x20 - All That Glitter.avi
 Renamed: Blue Bloods 1x21 - Cellar Boy.avi
 Renamed: Hawaii Five-0 (2010) 1x19 - Ne Me'e Laua Na Paio.avi
 Renamed: Hawaii Five-0 (2010) 1x20 - Ma Ke Kahakai.avi
 Renamed: Hawaii Five-0 (2010) 1x21 - Ho'opa'i.avi
 Renamed: Hawaii Five-0 (2010) 1x22 - Ho'ohuli Na'au.avi
 Renamed: Hawaii Five-0 (2010) 1x23 - Ua Hiki Mai Kapalena Pau.avi
 
 Rename pass completed. 9 files renamed.
 
 Beginning rename pass..
 Renamed: Hawaii Five-0 1x19 - Ne Me'e Laua Na Paio.avi
 Renamed: Hawaii Five-0 1x20 - Ma Ke Kahakai.avi
 Renamed: Hawaii Five-0 1x21 - Ho'opa'i.avi
 Renamed: Hawaii Five-0 1x22 - Ho'ohuli Na'au.avi
 Renamed: Hawaii Five-0 1x23 - Ua Hiki Mai Kapalena Pau.avi
 
 Rename pass completed. 5 files renamed.
 
 Beginning rename pass..
 Renamed: House 7x18 - The Dig.avi
 Renamed: House 7x19 - Last Temptation.avi
 Renamed: House 7x20 - Changes.avi
 Renamed: House 7x21 - The Fix.avi
 
 Rename pass completed. 4 files renamed.
 
 Beginning rename pass..
 Renamed: How I Met Your Mother 6x20 - The Exploding Meatball Sub.avi
 Renamed: How I Met Your Mother 6x21 - Hopeless.avi
 Renamed: How I Met Your Mother 6x22 - The Perfect Cocktail.avi
 Renamed: How I Met Your Mother 6x23 - Landmarks.avi
 
 Rename pass completed. 4 files renamed.
 
 Beginning rename pass..
 Renamed: NCIS 8x21 - Dead Reflection.avi
 Renamed: NCIS 8x22 - Baltimore.avi
 Renamed: NCIS 8x23 - Swan Song.avi
 
 Rename pass completed. 3 files renamed.
 
 Beginning rename pass..
 Renamed: NCIS Los Angeles 2x21 - Rocket Man.avi
 Renamed: NCIS Los Angeles 2x22 - Plan B.avi
 Renamed: NCIS Los Angeles 2x23 - Imposters.avi
 Renamed: Stargate Universe 2x16 - The Hunt.avi
 Renamed: Stargate Universe 2x17 - Common Descent (1).avi
 Renamed: Stargate Universe 2x18 - Epilogue (2).avi
 Renamed: Stargate Universe 2x19 - Blockade.avi
 Renamed: Stargate Universe 2x20 - Gauntlet.avi
 
 Rename pass completed. 8 files renamed.
 
 Beginning rename pass..
 Renamed: The Big Bang Theory 4x20 - The Herb Garden Germination.avi
 Renamed: The Big Bang Theory 4x21 - The Agreement Dissection.avi
 Renamed: The Big Bang Theory 4x22 - The Wildebeest Implementation.avi
 
 Rename pass completed. 3 files renamed.
 
 Beginning rename pass..
 Renamed: The Mentalist 3x19 - Every Rose Has Its Thorn.avi
 Renamed: The Mentalist 3x20 - Redacted.avi
 Renamed: The Mentalist 3x21 - Like a Redheaded Stepchild.avi
 
 Rename pass completed. 3 files renamed.
I just removed the extra 0's before season names and the (2010) in Hawaii 5-0 >.<

I'll package up my app and upload it somewhere, you should have it soon :)

It can be downloaded here: http://filebeam.com/...2373705cc2610b9

Just had to remove some test code >.> Sorry for the delay. Let me know how it goes!

#10 OP articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 12 May 2011 - 11:10

I should also note it's case sensitive. The number beside the "From" bar is the number of files that will be affected.

Last but not least: please be careful >.<

#11 JAGFin1

JAGFin1

    I like turtles.

  • Joined: 09-August 10
  • Location: Devon, UK

Posted 12 May 2011 - 11:20

Just tested it out on my Farscape collection. Renamed from 01x01 - Premiere to Farscape - 01x01 - Premiere. Nice and quick. I still think some form of auto renaming via database would be nice. It's a cool app but I think I'll stick with EpNamer for now.

#12 OP articuno1au

articuno1au

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 12 May 2011 - 11:23

I think I will too :p

I'll use my app along side it. I think it's also going to be useful for my music collection..

The number of albums that have rip names attached to them >.>

Glad it worked for you :)