Regular expressions for renaming files

I have a list of files I want to rename, but want to retain a number, date, subject, and filetype.

The list is formatted as:

Deuce_Plays_-_Episode_100_-_12-7-2010_-_PLO_with_Slow_Habit_Part_2.mp3
Deuce_Plays_-_Episode_101_-_12-14-2010_-_PLO_with_Slow_Habit_Part_3.mp3
Deuce_Plays_-_Episode_109_-_2-8-2011_-_Baluga_Whale_II_Part_1.mp3
Deuce_Plays_-_Episode_10_-_3-17-2009_-_High_Stakes_Poker_with_Baluga_Whale.mp3
Deuce_Plays_-_Episode_110_-_2-15-2011_-_Baluga_Whale_II_Part_2.mp3
Deuce_Plays_-_Episode_111_-_2-22-2011_-_Hands_from_a_Split_Pot_Cash_Game.mp3
Deuce_Plays_-_Episode_115_-_3-22-2011_-_Limon_III.mp3
Deuce_Plays_-_Episode_11_-_3-24-2009_-_Special_Guest_Baluga_Whale.mp3
Deuce_Plays_-_Episode_127_-_8-2-2011_-_Live_No_Limit_Leaks_Part_1.mp3
Deuce_Plays_-_Episode_128_-_8-9-2011_-_Live_No_Limit_Leaks_Part_2.mp3
Deuce_Plays_-_Episode_13_-_4-7-2009_-_Special_Guest_DeathDonkey.mp3
Deuce_Plays_-_Episode_33_-_8-25-2009_-_PLO_with_Michealsc.mp3
Deuce_Plays_-_Episode_34_-_9-1-2009_-_Hands_From_a_Cash_Game_Session_Part_1.mp3
Deuce_Plays_-_Episode_35_-_9-8-2009_-_Hands_From_a_Cash_Game_Session_Part_2.mp3
Deuce_Plays_-_Episode_37_-_9-22-2009_-_Special_Guest_Limon.mp3
Deuce_Plays_-_Episode_39_-_10-6-2009_-_Special_Guest_Phil_Galfond_Part_1.mp3
Deuce_Plays_-_Episode_40_-_10-13-2009_-_Special_Guest_Phil_Galfond_Part_2.mp3
Deuce_Plays_-_Episode_44_-_11-10-2009_-_Tommy_Angelo_II_Part_1.mp3
Deuce_Plays_-_Episode_45_-_11-17-2009_-_Tommy_Angelo_II_Part_2.mp3
Deuce_Plays_-_Episode_52_-_1-5-2010_-_Range_Analysis_and_Slowplaying.mp3
Deuce_Plays_-_Episode_57_-_2-9-2010_-_Split_Pot_Gamesl.mp3
Deuce_Plays_-_Episode_59_-_2-23-2010_-_DeathDonkey_on_Baduci.mp3
Deuce_Plays_-_Episode_61_-_3-9-2010_-_FoxwoodsFiend_on_Coaching.mp3
Deuce_Plays_-_Episode_62_-_3-16-2010_-_Cash_Game_Analysis_and_Call_Ins_II.mp3
Deuce_Plays_-_Episode_67_-_4-20-2010_-_Bet_Sizing_and_Perceived_Range.mp3
Deuce_Plays_-_Episode_68_-_4-27-2010_-_Image.mp3
Deuce_Plays_-_Episode_70_-_5-11-2010_-_LIMON_II.mp3
Deuce_Plays_-_Episode_72_-_5-25-2010_-_Bobby_Hoff.mp3
Deuce_Plays_-_Episode_84_-_8-17-2010_-_No_Limit_Analysis_With_SlowHabit.mp3
Deuce_Plays_-_Episode_85_-_8-24-2010_-_No_Limit_Analysis_with_SlowHabit_Part_2.mp3
Deuce_Plays_-_Episode_86_-_8-31-2010_-_No_Limit_Analysis_with_SlowHabit_Part_3.mp3
Deuce_Plays_-_Episode_88_-_9-14-2010_-_Turn_Play.mp3
Deuce_Plays_-_Episode_89_-_9-21-2010_-_Hands_From_a_Cash_Game_Volume_II_Part_1.mp3
Deuce_Plays_-_Episode_90_-_9-28-2010_-_Hands_From_a_Cash_Game_Volume_II_Part_2.mp3
Deuce_Plays_-_Episode_94_-_10-26-2010_-_Playing_Against_Good_Players_-_Line_Variations.mp3
Deuce_Plays_-_Episode_99_-_11-30-2010_-_PLO_with_Slow_Habit_Part_1.mp3
Deuce_Plays_-_Episode_9_-_3-10-2009_-_Special_Guest_Gman.mp3

format is  (Deuce_Plays_-_(1)_-_(mm-dd-yyyy)_-_(3).mp3

Key steps:

  1. recognizing non-alphanumeric characters in regular expressions
  2. keeping episode number (1) and title (3)
  3. reformatting date to mm-dd-yy

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s