+ Post New Thread
Results 1 to 6 of 6
How do you do....it? Thread, rename files using wildcards in Technical; I've got a series of files called Voyager - 3xx -EpisodeName.avi that need renaming to Voyager.S03Exx.EpisodeName.avi to make my DLNA ...
  1. #1

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    4,963
    Thank Post
    1,187
    Thanked 444 Times in 347 Posts
    Rep Power
    136

    rename files using wildcards

    I've got a series of files called Voyager - 3xx -EpisodeName.avi that need renaming to Voyager.S03Exx.EpisodeName.avi to make my DLNA server happy.

    Any cmd line guru's able to come up with anything?

    Si

  2. IDG Tech News

  3. #2


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    3,844
    Thank Post
    149
    Thanked 1,228 Times in 924 Posts
    Rep Power
    305
    If this is just a one-off, I would probably use Renamer.


  4. Thanks to Arthur from:

    SimpleSi (14th April 2011)

  5. #3

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    1,417
    Thank Post
    175
    Thanked 224 Times in 210 Posts
    Rep Power
    112
    Quote Originally Posted by SimpleSi View Post
    I've got a series of files called Voyager - 3xx -EpisodeName.avi that need renaming to Voyager.S03Exx.EpisodeName.avi to make my DLNA server happy.

    Any cmd line guru's able to come up with anything?

    Si
    Are the episode names in any format, or any length etc? You could do wildcard renames in CMD, but easiest ways all have fixed lengths of wildcards, which I'm guessing you don't?

    Could try to knock up a vbs version, or try to fix CMD, but our networks going offline today for repairs, so don't know how much time I'll have during day :P (or shout if you're using Renamer and I wont knock one )

    Steve

  6. #4

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    4,963
    Thank Post
    1,187
    Thanked 444 Times in 347 Posts
    Rep Power
    136
    @Arthur
    Lovely find - just the job

    Still like to know if there's a proper geeks way of doing it in XP cmd line though

    Simon

  7. #5

    jinnantonnixx's Avatar
    Join Date
    Mar 2011
    Location
    In the Calamatorium.
    Posts
    895
    Thank Post
    38
    Thanked 171 Times in 128 Posts
    Rep Power
    111
    Well, it's not elegant, but it should work....

    Code:
    SETLOCAL ENABLEDELAYEDEXPANSION
    for /L %%e in (1,1,99) do call :renfile %%e
    goto :eof
    :renfile
    set e=%1
    if %e% LSS 10 (
    	set episode=0%e%
    ) else (
    	set episode=%e%
    )
    rename "Voyager - 3%episode% -EpisodeName.avi" "Voyager.S03E%episode%.EpisodeName.avi"
    You could probably get it down to a one-liner if you did a FOR /F tokens..... in (dir /b Voyager*) rename etc.
    Last edited by jinnantonnixx; 14th April 2011 at 09:53 AM.

  8. Thanks to jinnantonnixx from:

    SimpleSi (14th April 2011)

  9. #6


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    3,844
    Thank Post
    149
    Thanked 1,228 Times in 924 Posts
    Rep Power
    305
    Quote Originally Posted by SimpleSi View Post
    Still like to know if there's a proper geeks way of doing it in XP cmd line though
    Do you reckon this PowerShell script is geeky enough?

    Code:
    $regex = "^(Voyager)(?:\s-\s)(\d{1,2})(\d{2})(?:\s-)(.*)\.(\w{3})$"
    Get-ChildItem -filter *.avi | Where-Object { $_.Name -match $regex } | Rename-Item -NewName { $_.Name -Replace $regex, "`$1.S0`$2E`$3.`$4.`$5" }
    Edit. Need to figure out a way to do something similar to what Jinnantonnixx did with the series and/or episode numbers.
    Last edited by Arthur; 15th April 2011 at 08:58 AM.

  10. Thanks to Arthur from:

    SimpleSi (15th April 2011)

SHARE:
+ Post New Thread

Similar Threads

  1. Mass rename files and folders with an ampersand
    By AlexPilot in forum Windows
    Replies: 1
    Last Post: 13th October 2010, 10:46 AM
  2. Rename a batch of files all at once.
    By Kyle in forum How do you do....it?
    Replies: 10
    Last Post: 19th November 2009, 07:31 AM
  3. Smoothwall wildcards - MySpace signups
    By theeldergeek in forum Internet Related/Filtering/Firewall
    Replies: 1
    Last Post: 7th October 2009, 12:50 PM
  4. Can't rename files/folder
    By adamf in forum Windows
    Replies: 5
    Last Post: 30th January 2009, 12:32 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •