Results 1 to 6 of 6

Thread: [SOLVED] massive rename files

  1. #1
    Join Date
    Oct 2007
    Beans
    26
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    [SOLVED] massive rename files

    Hi there,

    I had my terminal resize a lot of pictures which where in medium size to thumbnails.

    My medium files start with mo_ and my thumbs with th_

    Now my thumbnails are starting with th_mo_filename.jpg

    Is it possible to remove the mo_?

    Thanks in advance!

    (i'm sorry for my english, still practicing.)
    24/7 Ubuntu user.

  2. #2
    Join Date
    Apr 2008
    Beans
    21

    Wink Re: massive rename files

    get metamorphose from getdeb.net will do all of it....

  3. #3
    Join Date
    Apr 2007
    Location
    Vancouver, BC
    Beans
    184
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: massive rename files

    Get Krename from the repos.

    http://www.krename.net/
    Refugee from openSuse ever since they sold out to M$

  4. #4
    Join Date
    Jul 2007
    Beans
    1,577

    Re: massive rename files

    Or thunar's bulk rename... in the repos too.

  5. #5
    Join Date
    Oct 2006
    Location
    Lyon, France
    Beans
    839
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: massive rename files

    Or use rename, it's already installed.

    rename -n 's/mo_//' *.jpg

    Note the -n that ensures no file will actually be renamed, but instead show what files would have been renamed and how. Run the same command without -n once you are sure it does what you expect.
    This is the first age that's paid much attention to the future, which is a little ironic since we may not have one.
    -- Arthur C. Clarke

  6. #6
    Join Date
    Sep 2006
    Beans
    2,914

    Re: massive rename files

    Quote Originally Posted by zetjee View Post
    Hi there,

    I had my terminal resize a lot of pictures which where in medium size to thumbnails.

    My medium files start with mo_ and my thumbs with th_

    Now my thumbnails are starting with th_mo_filename.jpg

    Is it possible to remove the mo_?

    Thanks in advance!

    (i'm sorry for my english, still practicing.)
    you can use the script here
    eg usage:
    Code:
    ./filerenamer.py -p "mo_" -e "" -l "th_mo*jpg" #use -l to list files to be changed only
    ./filerenamer.py -p "mo_" -e "" "th_mo*jpg" #remove -l to commit
    or if you want to learn how to do it
    Code:
    for files in th_mo*
    do  
       mv "$files" ${files/mo_/}
    done
    Last edited by ghostdog74; September 19th, 2008 at 03:12 AM.

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
  •