Results 1 to 5 of 5

Thread: Need Some Shell Help Bulk Renaming Files

  1. #1
    Join Date
    Oct 2005
    Location
    Lynnwood, Washington
    Beans
    13
    Distro
    Ubuntu 11.04 Natty Narwhal

    Need Some Shell Help Bulk Renaming Files

    I need some advise for a shell command or script to bulk rename filenames. My digital camera names files with the JPG extension capitalized, which creates big problems while coding web pages. So is there a simple way to rename all of these files with a lowercase jpg extension?

  2. #2
    Join Date
    Jan 2008
    Location
    /us/al/home/mb_webguy
    Beans
    2,340
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Need Some Shell Help Bulk Renaming Files

    If all of the files are in the same directory, you can use:
    Code:
    rename -v 's/\.JPG/\.jpg/' *.JPG
    If they are in different directories, you'll have to use the following command from the topmost directory:
    Code:
    find ./ -name *.JPG -exec rename -v 's/\.JPG/\.jpg/' {} \;
    However, an easy way to rename large numbers of files is to use the GPRename program, which is an easy-to-use GUI batch file renaming utility.

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

    Re: Need Some Shell Help Bulk Renaming Files

    Quote Originally Posted by DoctorDemento View Post
    I need some advise for a shell command or script to bulk rename filenames. My digital camera names files with the JPG extension capitalized, which creates big problems while coding web pages. So is there a simple way to rename all of these files with a lowercase jpg extension?
    you can use the Python script here
    eg usage

    Code:
    ./filerenamer.py -p ".JPG" -e ".jpg" -l "*.JPG" #list only
    ./filerenamer.py -p ".JPG" -e ".jpg"  "*.JPG"  # remove -l to commit
    or if you want to do it by hand
    Code:
    for files in *JPG
    do
     mv "$files" "${files/JPG/jpg}"
    done

  4. #4
    Join Date
    Oct 2005
    Location
    Lynnwood, Washington
    Beans
    13
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Need Some Shell Help Bulk Renaming Files

    Thank you, those both worked great.

  5. #5
    Join Date
    Nov 2010
    Location
    Denmark
    Beans
    4
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Need Some Shell Help Bulk Renaming Files

    Quote Originally Posted by mb_webguy View Post
    However, an easy way to rename large numbers of files is to use the GPRename program, which is an easy-to-use GUI batch file renaming utility.
    GPRename is excellent thank you!

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
  •