# Script needed for batch rename of files [moved from Windows 7/ Vista]



## leperwdup (Jun 4, 2011)

Need a script that I can use to rename a large amount of files from format

Tv Show - (Ep. #) - Episode Name

To

Tv Show - S#E# - Episode Name

I dont mind having to either change some of the script to identify the season # each time or I can rename the foldername to the season # that it is to work in with the script. But a script like this that I can put into alot of different directories and run it to batch rename would help me to rename the files so that my HTPC can pick them up correctly.

Any help would be appreciated, thank you.


----------



## jcgriff2 (Sep 30, 2007)

*Re: Script needed for batch rename of files*



leperwdup said:


> Need a script that I can use to rename a large amount of files from format
> 
> Tv Show - (Ep. #) - Episode Name
> 
> ...


Where does the Season # come from?

Are the file names variable in length?

Can you give me a list of the exact current file names (about 15 - or more) and what you want them to be?

Regards. . .

jcgriff2

`


----------



## leperwdup (Jun 4, 2011)

*Re: Script needed for batch rename of files*

File names are variable in length and the season number currently comes from the folder name.

Some examples of the file names are as follows;

TaleSpin - (Ep. 01) - Plunder & Lightning (Part 01)
TaleSpin - (Ep. 02) - Plunder & Lightning (Part 02)
TaleSpin - (Ep. 03) - Plunder & Lightning (Part 03)
TaleSpin - (Ep. 04) - Plunder & Lightning (Part 04)
TaleSpin - (Ep. 05) - From Here To Machinery
TaleSpin - (Ep. 06) - It Came From Beneath The Sea Duck
TaleSpin - (Ep. 07) - Time Waits For No Bear
Pinky And The Brain - (Ep. 01) - Das Mouse
Pinky And The Brain - (Ep. 02) - Of Mouse And Man
Pinky And The Brain - (Ep. 09) - Snowball
Pinky And The Brain - (Ep. 11) - Fly
Darkwing Duck - (Ep. 01) - That Sinking Feeling
Darkwing Duck - (Ep. 02) - Film Flam
Darkwing Duck - (Ep. 03) - Negaduck

Example of what I want them to be after;

TaleSpin - s1e1 - Plunder & Lightning (Part 01)
TaleSpin - s1e2 - Plunder & Lightning (Part 02)
TaleSpin - s1e3 - Plunder & Lightning (Part 03)
TaleSpin - s1e4 - Plunder & Lightning (Part 04)
TaleSpin - s1e5 - From Here To Machinery
TaleSpin - s1e6 - It Came From Beneath The Sea Duck
TaleSpin - s1e7 - Time Waits For No Bear
Pinky And The Brain - s1e1 - Das Mouse
Pinky And The Brain - s1e2 - Of Mouse And Man
Pinky And The Brain - s1e9 - Snowball
Pinky And The Brain - s1e11 - Fly
Darkwing Duck - s2e1 - That Sinking Feeling
Darkwing Duck - s2e2 - Film Flam
Darkwing Duck - s2e3 - Negaduck

As you can see they are for cartoons for my children haha. Just trying to find an easy way to add them to the frontend (XBMC) for my HTPC so that they can view them easily. Without me having to rename them all manually that is. There are over 3000 different files so anything to make it that I dont have to do them all manually would be a big help.


----------



## jcgriff2 (Sep 30, 2007)

*Re: Script needed for batch rename of files*

The variable file names and variable information = endless possibilities.

The "season" is unknown - 

```
[COLOR=navy][U]BEFORE[/U][/COLOR]
[FONT=Lucida Console]TaleSpin - (Ep. 01) - Plunder & Lightning (Part 01)[/FONT]
[FONT=Lucida Console]TaleSpin - (Ep. 02) - Plunder & Lightning (Part 02)[/FONT]
 
[COLOR=navy][U]AFTER[/U][/COLOR]
[FONT=Lucida Console]TaleSpin - [COLOR=red]s1[/COLOR]e1 - Plunder & Lightning (Part 01)[/FONT]
[FONT=Lucida Console]TaleSpin - [COLOR=red]s1[/COLOR]e2 - Plunder & Lightning (Part 02)[/FONT]
```
 

```
[U][COLOR=#000080]BEFORE[/COLOR][/U]
[FONT=Lucida Console]Darkwing Duck - (Ep. 01) - That Sinking Feeling[/FONT]
[FONT=Lucida Console]Darkwing Duck - (Ep. 02) - Film Flam[/FONT]
[FONT=Lucida Console]Darkwing Duck - (Ep. 03) - Negaduck[/FONT]
 
[U][COLOR=#000080]AFTER[/COLOR][/U] 
[FONT=Lucida Console]Darkwing Duck - [COLOR=red]s2[/COLOR]e1 - That Sinking Feeling[/FONT]
[FONT=Lucida Console]Darkwing Duck - [COLOR=red]s2[/COLOR]e2 - Film Flam[/FONT]
[FONT=Lucida Console]Darkwing Duck - [COLOR=red]s2[/COLOR]e3 - Negaduck[/FONT]
```
Sorry, but I don't see how this could easily be done w/ batch scripting. 

Regards. . .

jcgriff2

`


----------



## niemiro (Feb 20, 2010)

Hello!

Do you know any programming languages? C# would be nice and simple, and could do this with ease. 

Also, what are the formats of the directories. You say that they are the series numbers.

Are they actually:

1
2
3
4

or not quite that simple!

Thanks a lot!

Richard


----------



## leperwdup (Jun 4, 2011)

Yes the directories can be renamed to 1, 2, 3, 4 this is no problem its jus that each directory contains 50-60 episodes due to old cartoons having that many episodes per season. No I dont know C+


----------



## niemiro (Feb 20, 2010)

leperwdup said:


> Yes the directories can be renamed to 1, 2, 3, 4 this is no problem its jus that each directory contains 50-60 episodes due to old cartoons having that many episodes per season. No I dont know C+


Hello again!

I don't want to commit myself to a time schedule, because I have exams until 17th June, but I would be willing to write an application to do this for you.

What is the current format of the directories? The file are quite easy. I can split by "-", and then take the second entry from the array converted to List<> (I won't actually use this method, because it is inefficient, but it gets the point across), and then use Regex. 

Thanks a lot!

Richard


----------



## leperwdup (Jun 4, 2011)

Figured I would let you know so you didn't go ahead with anything I have already written a script to fix this . Was able to simplify the actions required to do all the relabeling and created a 600 line autohotkey macro that is able to do each directory separately for me.

Thanks anyways

Azz


----------

