Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

  1. Follow us on twitter - we shoot all of our new original content out as well as random messages. https://twitter.com/linuxdotorg
    Dismiss Notice

Changing files extention

Discussion in 'General Linux' started by Pruthvi123, Nov 17, 2018.

Tags:
  1. Pruthvi123

    Pruthvi123 New Member

    Joined:
    Nov 17, 2018
    Messages:
    1
    Likes Received:
    0
    I have these 400 pictures saved as .FIT and I need to change them into .fit
    I have tried the following commands:
    rename *.FIT fit field=etn
    and
    rm 'oldfile'.FIT 'oldfile'.fit

    Both don't seem to work for iraf


    (Log in to hide this advertisement)

     
  2. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    2,294
    Likes Received:
    1,995
    G'day @Pruthvi123 and welcome to linux.org :)

    What Distro are you using?

    Chris Turner
    wizardfromoz
     
  3. patrick2011

    patrick2011 New Member

    Joined:
    Feb 4, 2019
    Messages:
    3
    Likes Received:
    3
    Code:
    for f in *.FIT; do
        mv -- "$f" "${f%.FIT}.fit"
    done
    
     
    wizardfromoz and Kryptoghost like this.
  4. JasKinasis

    JasKinasis Well-Known Member

    Joined:
    Apr 25, 2017
    Messages:
    331
    Likes Received:
    641
    Or more simply:
    Code:
    rename .FIT .fit *.FIT
    
     
  5. patrick2011

    patrick2011 New Member

    Joined:
    Feb 4, 2019
    Messages:
    3
    Likes Received:
    3
    Does not work on all distro's.
     
  6. Kryptoghost

    Kryptoghost New Member

    Joined:
    Jan 11, 2019
    Messages:
    25
    Likes Received:
    21
    well typically the only difference between distros are, whats installed. So if you don't have rename on your distro you could just install it.
     
    wizardfromoz likes this.
  7. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    2,294
    Likes Received:
    1,995
    ... hence my asking the OP what Distro is he using?

    What Distro are you using, Patrick?

    Wizard
     
  8. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    400
    Likes Received:
    844
    also, if they're in dif directories.. you could do something like.. (borrowing the mv portion from above...)

    Code:
    for file in $(find /path/ -type f -name *.FIT);do mv -- "$file" "${file%.FIT}.fit" ;done
    Edit: if using 'rename', I wrote this a while ago, but seems like centos/fedora have one 'rename' while others (ubuntu, etc..) have other flags..
    https://www.linuxos.pro/rename-multiple-files-in-linux/
     

Share This Page