Results 1 to 3 of 3

Thread: Mass rename: remove prefix

  1. #1
    Join Date
    Sep 2007
    Beans
    231

    Mass rename: remove prefix

    I have a bunch of files which are named like this:

    01_asdsdsdsad
    02_131l2kj2jk
    03_a--00asd90
    ...

    You get the idea. I want to use "rename" or a bash script to remove the two digits and the underscore from the beginning of the file. It is always three characters long. Any advice?

  2. #2
    Join Date
    Apr 2012
    Beans
    5,410

    Re: Mass rename: remove prefix

    you could try

    Code:
    rename -n -v 's/^[0-9]{2}_//' *
    if it appears to be matching correctly then remove the '-n' (dry run) to make it actually modify the names

  3. #3
    Join Date
    Sep 2007
    Beans
    231

    Re: Mass rename: remove prefix

    Thanks!

Bookmarks

Posting Permissions

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