View previous topic :: View next topic |
Author |
Message |
nharding
Joined: 19 Nov 2007 Posts: 11
|
Posted: Wed Dec 12, 2007 2:11 pm Post subject: Rename based on directory |
|
|
I've wrote another new user defined command. It's used to rename files based on directory name, If you have
c:\videos\Buffy The Vampire Slayer (Season 1)\BTVS 01.mpg
c:\videos\Buffy The Vampire Slayer (Season 1)\buffy 02.mpg
c:\videos\Buffy The Vampire Slayer (Season 1)\Buffy Vampire Slayer 03.avi
c:\videos\Buffy The Vampire Slayer (Season 1)\BVS 04.avi
The files will be renamed (there are 2 variants of the command), one insists on all words being present (even if in abbreviated form), and the other only needs to match the 1st word. It strips out contents of () [] {} and uses the directories to match.
The files would end up being renamed to
Buffy The Vampire Slayer 01.mpg
I will be posting the code soon, along with my date renamer.
Neil Harding |
|
Back to top |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Thu Dec 13, 2007 3:12 am Post subject: |
|
|
I don't think you need a user defined plugin command for this.
What if you did the following:
Row: 1
Search: '(?i).*?(btvs|buffy|bvs|vampire sl).*?([0-9]{2,2})[.](.{3,3})$'
Replace: ' \2.\3'
Row: 2
Search:
Replace: '*Insert Folder before*Prefix*'
Row: 3
Search: '(?x) [\{\(\[]+.*?[\]\}\)]+ # delete brackets + contents'
Replace:
For the folder insertion, just configure the folder insertion option to not add a separator (don't enter any characters in separator specifier).
Peter. |
|
Back to top |
|
 |
nharding
Joined: 19 Nov 2007 Posts: 11
|
Posted: Thu Dec 13, 2007 3:24 am Post subject: |
|
|
The idea of this user defined command is that it automatically generates the regular expression. It even looks through the entire path, so if you have Josh Wedon\Buffyverse\Buffy the Vampire Slayer\Season 1\, it will look and see if any of the parts match.
Neil Harding |
|
Back to top |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Thu Dec 13, 2007 7:07 am Post subject: |
|
|
Cool - Can't wait to see it.
Peter. |
|
Back to top |
|
 |
|