Results 1 to 10 of 22

Thread: rename and regex

Threaded View

  1. #1
    Join Date
    Dec 2007

    rename and regex

    How can you batch rename files while retaining certain portions and replacing others? For example:

    original filename:

    renamed to:

    All files have this same format but: the suffix is not always the same text; the prefix is not always the same; the numbers after Y and Z change from file to file.

    What I am looking for is something along the lines of

    rename 's/.+YxxZxx.+\.ext/yxxzxx\.ext/' *.ext

    where xx leaves that digit intact. I know about a program but that is overkill for what I want and it actually adds more than I want to the filenames.

    Last edited by rebeltaz; May 27th, 2013 at 10:10 PM. Reason: removed prohibited content


Posting Permissions

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