Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Rename files

  1. #21
    Join Date
    Aug 2006
    Location
    Gilbert, AZ
    Beans
    134
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Rename files

    That worked but appended the word new to all the files, IE

    newback.png, newadd.png, etc

    I just want to leave the original link name in tact

    back.png add.png

  2. #22
    Join Date
    Jun 2008
    Location
    California
    Beans
    2,271
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Rename files

    Quote Originally Posted by jesterthejedi View Post
    That worked but appended the word new to all the files,...
    Sorry, there was an error in my earlier command, which I've now fixed. The correct command is:

    Code:
    rename -v 's/^Link to //' *
    BTW, if you now have a bunch of files that begin with new, you can remove new with the following command:

    Code:
    rename -n 's/^new//' *
    The -n option in the above command directs rename to do a dry-run and report proposed changes. Then, if all appears well, substitute -v for -n to actually rename the files.
    Last edited by kaibob; April 27th, 2009 at 01:12 AM.

  3. #23
    Join Date
    Aug 2006
    Location
    Gilbert, AZ
    Beans
    134
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Rename files

    Thanks for your help. I will be able to add 5 sets to my icon theme and only require 1 hard set of png files and save massive space.

  4. #24
    Join Date
    Nov 2009
    Location
    Wrightwood, California
    Beans
    89
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Rename files

    I shared the frustration DeMus felt with the Rename examples she quoted in her post of February 21 and wished instead for some base instruction Formats. Either that page didn't have them or I glossed over the page too fast. Anyway, I was happy to see mb_Webguy's suggestion - to use instead GPRename, at least to start. I did and, although it also lacks a manual, found the main page to be extremely intuitive and able to satisfy any renaming need I might have in the near future. Thanks, DeMus, for bringing this up and thanks, mb_Webguy for taking the time to make the suggestion (and, of course Tristesse, et al, for writing it)!
    Regards,
    Fred

  5. #25
    Join Date
    Jun 2008
    Beans
    13

    Wink Re: Rename files

    Speaking of fun with perl... I have a hundred photos that I want to add "-thumb" on the end of the filename before the extension. Can anyone steer me in the right direction as to how I would do that with a bash command?

    e.g.

    photo1.jpg needs to be photo1-thumb.jpg

    I would like to batch rename all the files in a folder at once.

    Thank you for any help. My perl is not so good.

  6. #26
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Rename files

    In POSIX shells:
    Code:
    for f in *.jpg; do mv -iv "$f" "${f%.jpg}-thumb.jpg"; done
    (See http://mywiki.wooledge.org/BashFAQ/073)

    Or with prename:
    Code:
    prename -n 's/\.jpg/-thumb.jpg/' *.jpg

  7. #27
    Join Date
    Jun 2008
    Beans
    13

    Re: Rename files

    Hi Geirha,

    Thank you for the help.

    - Phil

  8. #28
    Join Date
    Aug 2008
    Location
    Kelowna, BC
    Beans
    20
    Distro
    Ubuntu 10.04 Lucid Lynx

    Talking Re: Rename files

    I just want to say that my script works just as well in Ubuntu 12.10 as it did in previous versions of Ubuntu. Saves me tons of time when importing photos from the camera. I lost the script when I reinstalled Ubuntu, thankfully I had posted it here on the forum so I could just follow my own instructions!

Page 3 of 3 FirstFirst 123

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
  •